diff --git a/src/Thumbhash.php b/src/Thumbhash.php index 60d7b57..c46f01e 100644 --- a/src/Thumbhash.php +++ b/src/Thumbhash.php @@ -140,6 +140,10 @@ public static function convertHashToString(array $hash): string return rtrim(base64_encode(implode(array_map("chr", $hash))), '='); } + public static function convertStringToHash(string $str): array + { + return array_map("ord", str_split(base64_decode($str . "="))); + } /** * Decodes a ThumbHash to an RGBA image. RGB is not premultiplied by A.