{"id":13518484,"url":"https://github.com/SRWieZ/thumbhash","last_synced_at":"2025-03-31T10:31:47.052Z","repository":{"id":146264843,"uuid":"617923305","full_name":"SRWieZ/thumbhash","owner":"SRWieZ","description":"Thumbhash implementation in PHP","archived":false,"fork":false,"pushed_at":"2025-02-17T11:06:49.000Z","size":72,"stargazers_count":142,"open_issues_count":0,"forks_count":6,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-03-25T09:05:22.999Z","etag":null,"topics":["image","lazy-loading","php","thumbhash"],"latest_commit_sha":null,"homepage":"https://srwiez.com/open-source","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/SRWieZ.png","metadata":{"files":{"readme":"readme.md","changelog":"changelog.md","contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"SRWieZ"}},"created_at":"2023-03-23T11:52:34.000Z","updated_at":"2025-02-17T11:06:52.000Z","dependencies_parsed_at":"2024-02-07T17:56:01.884Z","dependency_job_id":"941851af-85a0-405d-95c2-4ecd348fdd7d","html_url":"https://github.com/SRWieZ/thumbhash","commit_stats":{"total_commits":18,"total_committers":5,"mean_commits":3.6,"dds":0.2222222222222222,"last_synced_commit":"3983c6f1aec32d8a037cc66175c0550f12c3f9e2"},"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SRWieZ%2Fthumbhash","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SRWieZ%2Fthumbhash/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SRWieZ%2Fthumbhash/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SRWieZ%2Fthumbhash/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/SRWieZ","download_url":"https://codeload.github.com/SRWieZ/thumbhash/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246453631,"owners_count":20779987,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["image","lazy-loading","php","thumbhash"],"created_at":"2024-08-01T05:01:45.347Z","updated_at":"2025-03-31T10:31:47.046Z","avatar_url":"https://github.com/SRWieZ.png","language":"PHP","readme":"# Thumbhash PHP\n[![Tests](https://github.com/SRWieZ/thumbhash/actions/workflows/test.yml/badge.svg)](https://github.com/SRWieZ/thumbhash/actions/workflows/tests.yml)\n[![Latest Stable Version](https://poser.pugx.org/srwiez/thumbhash/v/stable)](https://packagist.org/packages/srwiez/thumbhash)\n\nThumbhash PHP is a PHP library for generating unique, human-readable identifiers from image files. It is inspired by [Evan Wallace's Thumbhash algorithm](https://github.com/evanw/thumbhash) and provides a PHP implementation of the algorithm.\n\nThumbhash is a very compact representation of a placeholder for an image. Store it inline with your data and show it while the real image is loading for a smoother loading experience. It's similar to [BlurHash](https://github.com/woltapp/blurhash) but with some advantages\n\n[Read more and test it here !](https://evanw.github.io/thumbhash/)\n\n## Installation\n\nYou can install Thumbhash PHP using Composer:\n\n```bash\ncomposer require srwiez/thumbhash\n```\n\n⚠️ I highly recommend to have Imagick extension installed on your computer. GD extension has only 7 bits of alpha channel resolution, and 127 is transparent, 0 opaque. While the library will still work, you may have different image between platforms. [See on stackoverflow](https://stackoverflow.com/questions/41079110/is-it-possible-to-retrieve-the-alpha-value-of-a-pixel-of-a-png-file-in-the-0-255)\n\n## Usage\n\nTo generate a thumbhash for an image file, you can use the Thumbhash\\Thumbhash class:\n\nExample to show a thumbhash image from a local file\n\n```php\nuse Thumbhash\\Thumbhash;\n\n$content = file_get_contents($url);\n\nlist($width, $height, $pixels) = extract_size_and_pixels_with_imagick($content);\n\n$hash = Thumbhash::RGBAToHash($width, $height, $pixels);\n$key = Thumbhash::convertHashToString($hash); // You can store this in your database as a string\n$url = Thumbhash::toDataURL($hash);\n\necho '\u003cimg src=\"' . $url . '\" /\u003e';\n```\n\n\u003e [!NOTE]\n\u003e Like the original library implementation, your image must not exceed 100x100 pixels.\n\n\n## Credits\n\nThumbhash PHP was created by Eser DENIZ. \n\nIt is inspired by the javascript version of [Evan Wallace's Thumbhash algorithm](https://github.com/evanw/thumbhash).\n\n## License\n\nThumbhash PHP is licensed under the MIT License. See LICENSE for more information.","funding_links":["https://github.com/sponsors/SRWieZ"],"categories":["PHP"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FSRWieZ%2Fthumbhash","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FSRWieZ%2Fthumbhash","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FSRWieZ%2Fthumbhash/lists"}