{"id":20251703,"url":"https://github.com/maximal/php-webp-thumbnailer","last_synced_at":"2025-04-10T23:16:24.273Z","repository":{"id":62525597,"uuid":"162297559","full_name":"maximal/php-webp-thumbnailer","owner":"maximal","description":"PHP (over Imagine) helper for creating and caching WebP thumbnails in real time","archived":false,"fork":false,"pushed_at":"2022-11-18T11:25:17.000Z","size":8,"stargazers_count":3,"open_issues_count":2,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-10T23:16:18.295Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/maximal.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-12-18T14:07:59.000Z","updated_at":"2021-12-16T10:08:09.000Z","dependencies_parsed_at":"2023-01-22T01:45:39.282Z","dependency_job_id":null,"html_url":"https://github.com/maximal/php-webp-thumbnailer","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maximal%2Fphp-webp-thumbnailer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maximal%2Fphp-webp-thumbnailer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maximal%2Fphp-webp-thumbnailer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maximal%2Fphp-webp-thumbnailer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/maximal","download_url":"https://codeload.github.com/maximal/php-webp-thumbnailer/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248312133,"owners_count":21082638,"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":[],"created_at":"2024-11-14T10:12:24.130Z","updated_at":"2025-04-10T23:16:24.245Z","avatar_url":"https://github.com/maximal.png","language":"PHP","readme":"# PHP thumbnailer with WebP support\n\n`WebpThumbnailer` is a thumbnail helper which allows you to generate\nand cache image thumbnails in your PHP application on the fly.\n\n\n## Installation\n\nInstall this library with Composer:\n```bash\nphp composer.phar require \"maximal/php-webp-thumbnailer\" \"*\"\n```\nor add\n```\n\"maximal/php-webp-thumbnailer\": \"*\"\n```\nto the `require` section of your app’s `composer.json` file.\n\n\n## Checking the environment\n\nYou will need WebP coder (`cwebp` command) installed in your system.\n\nFor instance in Ubuntu/Debian it is included in `webp` package:\n```bash\nsudo apt install webp\n```\n\nCheck the command:\n```bash\ncwebp -version\n```\nYou should get an output with version number (like `0.6.1`).\n\nIf you have installed `cwebp` to a different command or path, configure\nthe static property `WebpThumbnailer::$cwebpCommand` before using the helper\n(see the example below).\n\nMore info about WebP: https://developers.google.com/speed/webp/\n\n\n## Generating thumbnails\n\nUse this thumbnailer in your PHP application:\n```php\nuse maximal\\thumbnail\\WebpThumbnailer;\n\necho WebpThumbnailer::picture('/path/to/img/image.png', $width, $height);\n```\n\nMore options (`outbound`  instead of default `inset`; `alt` and `class`\nattribute added):\n```php\nuse maximal\\thumbnail\\WebpThumbnailer;\n\necho WebpThumbnailer::picture(\n\t'/path/to/img/image.png',\n\t$width,\n\t$height,\n\tfalse,\n\t['alt' =\u003e 'Alt attribute', 'class' =\u003e 'img-responsive']\n);\n```\n\nCustom `cwebp` command:\n```php\nuse maximal\\thumbnail\\WebpThumbnailer;\n\nWebpThumbnailer::$cwebpCommand = '/usr/local/bin/cwebp';\necho WebpThumbnailer::picture('/path/to/img/image.jpg', $width, $height);\n```\n\nThe helper’s `picture()` method uses modern `\u003cpicture\u003e` HTML tag as follows:\n```html\n\u003cpicture data-cache=\"hit|new\"\u003e\n\t\u003csource srcset=\"/assets/thumbnails/...image.png.webp\" type=\"image/webp\" /\u003e\n\t\u003cimg src=\"/assets/thumbnails/...image.png\" other-attributes=\"\" /\u003e\n\u003c/picture\u003e\n```\n\nHere you have `image/webp` source for\n[browsers which support WebP images](https://caniuse.com/#search=WebP)\nand traditional (PNG, JPEG, TIFF, GIF) image fallback.\n\n\n# Author\n\n* Websites: https://maximals.ru and https://sijeko.ru\n* StackOverflow story: http://stackoverflow.com/users/story/1021887\n* Twitter: https://twitter.com/almaximal\n* Telegram: https://t.me/maximal\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmaximal%2Fphp-webp-thumbnailer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmaximal%2Fphp-webp-thumbnailer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmaximal%2Fphp-webp-thumbnailer/lists"}