Skip to content

Commit

Permalink
convertStringToHash
Browse files Browse the repository at this point in the history
  • Loading branch information
marconett committed Mar 24, 2023
1 parent 0cfc704 commit 2fa9d58
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/Thumbhash.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 2fa9d58

Please sign in to comment.