{"id":16383672,"url":"https://github.com/ainsleyclark/squidge","last_synced_at":"2025-03-21T02:30:57.410Z","repository":{"id":39717717,"uuid":"427638285","full_name":"ainsleyclark/squidge","owner":"ainsleyclark","description":"🖼️ A FREE Wordpress Plugin to compress and convert images using cwebp, jpegoptim and optipng.","archived":false,"fork":false,"pushed_at":"2024-07-23T14:27:45.000Z","size":4832,"stargazers_count":44,"open_issues_count":9,"forks_count":8,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-01T01:51:13.296Z","etag":null,"topics":["avif","image","image-compression","image-converter","image-optimization","images","jpegoptim","libavif","optimization","optipng","png","webp","wordpress","wordpress-plugin"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ainsleyclark.png","metadata":{"files":{"readme":"README.md","changelog":null,"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},"funding":{"github":["ainsleyclark"]}},"created_at":"2021-11-13T10:50:12.000Z","updated_at":"2025-01-28T14:00:52.000Z","dependencies_parsed_at":"2023-01-29T23:46:05.246Z","dependency_job_id":null,"html_url":"https://github.com/ainsleyclark/squidge","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ainsleyclark%2Fsquidge","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ainsleyclark%2Fsquidge/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ainsleyclark%2Fsquidge/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ainsleyclark%2Fsquidge/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ainsleyclark","download_url":"https://codeload.github.com/ainsleyclark/squidge/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244102712,"owners_count":20398386,"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":["avif","image","image-compression","image-converter","image-optimization","images","jpegoptim","libavif","optimization","optipng","png","webp","wordpress","wordpress-plugin"],"created_at":"2024-10-11T04:09:23.011Z","updated_at":"2025-03-21T02:30:56.595Z","avatar_url":"https://github.com/ainsleyclark.png","language":"PHP","funding_links":["https://github.com/sponsors/ainsleyclark","https://www.paypal.com/donate?hosted_button_id=PQG5A34KWUXRJ"],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"left\"\u003e\n    \u003cimg alt=\"logo\" src=\"https://github.com/ainsleyclark/squidge/blob/master/assets/icon.svg\" width=\"40%\"\u003e\n\u003c/p\u003e\n\n# Squidge\n\nIs a **FREE** WordPress plugin, built with developers in mind, for the compression and conversion of images using `jpegoptim`,\n`optipng`, `cwebp`, and `libavif`. It’s **extremely** simple to use and is designed to increase PSI and boost rankings.\n\n[![Maintenance](https://img.shields.io/badge/Maintained%3F-yes-green.svg)](https://GitHub.com/Naereen/StrapDown.js/graphs/commit-activity)\n[![GNU General Public License 3.0](https://img.shields.io/github/license/ainsleyclark/squidge.svg)](https://www.gnu.org/licenses/gpl-3.0.en.html)\n[![Donate](https://img.shields.io/badge/Donate-PayPal-green.svg)](https://www.paypal.com/donate?hosted_button_id=PQG5A34KWUXRJ)\n[![Twitter](https://img.shields.io/twitter/follow/ainsleydev)](https://twitter.com/ainsleydev)\n\n\n## Why?\n\nImage compression in WordPress can be costly, confusing and sometimes just simply don't work. We have aimed to simplify\nthe process by requiring the developer to install the required package on the operating system and Squidge does the\nhard work for you.\n\n- **IT'S FREE**\n- Unlimited file size, no limits.\n- Optimised for your site to rank.\n- CLI to regenerate all of your media files.\n- Helper functions to output images in templates.\n- Uses the native `cwebp` and `libavif` libraries.\n\n## What does Squidge do?\n\nSquidge compresses and converts image files when the user has uploaded a file to WordPress.\n\nCompresses JPG images using `jpegoptim`.\n\nCompresses PNG images using `optipng`.\n\nConverts JPG and PNG images to `.webp` files using `cwebp` with the appended extension  e.g. `image.jpg.webp`.\n\nConverts JPG and PNG images to `.avif` files using `libavif` with the appended extension  e.g. `image.jpg.avif`.\n\n## Installation\n\n1. Go to the [releases](https://github.com/ainsleyclark/squidge/releases) section and download the plugin.\n2. Upload the `squidge` plugin to your `/wp-content/plugins/` directory.\n3. Activate the plugin through the \"Plugins\" menu in WordPress.\n4. Check the Settings tab under `Settings | Squidge Options` to ensure the libraries are installed, if they aren't,\n   run the commands listed dependent on your operating system.\n5. Check the individual optimisation tabs and adjust settings accordingly.\n6. Done!\n\n## Render Images\n\nTo render images in templates, you can either set up nginx or apache rules to serve images dynamically or used the\n`squidge_image` helper function. This dynamically checks if an `.avif` or `.webp` file is available on the file system\nand returns the output.\n\n### Function\n```php\n/**\n * Returns a \u003cpicture\u003e element with source media for the standard file passed\n * (such as a JPG), the .avif file, the .webp file (if to exist on the file system).\n *\n * Appropriate \u003csource\u003e elements for image sizes with max widths.\n * Finally, the main be outputted with alt and title text.\n *\n * - If lazy is true, the data-src or data-srcset will be appended.\n * - If a class is set, the class will be outputted on the \u003cpicture\u003e element.\n *\n * @param $image_id\n * @param string $class\n * @param false $lazy\n * @return string\n */\nfunction squidge_image($image_id, $class = '', $lazy = false)\n```\n\n### Output\n```html\n\u003cpicture class=\"picture\"\u003e\n\t\u003c!-- Loads if AVIF is supported and the window is smaller than 400px wide --\u003e\n\t\u003csource media=\"(max-width: 400px)\" srcset=\"/sample-image.jpg.avif\" type=\"image/avif\"\u003e\n\t\u003csource media=\"(max-width: 400px)\" srcset=\"/sample-image.jpg.webp\" type=\"image/webp\"\u003e\n\t\u003csource media=\"(max-width: 400px)\" srcset=\"/sample-image.jpg\"\u003e\n\t\u003c!-- AVIF \u0026 Wep Initial Sizes --\u003e\n\t\u003csource srcset=\"/sample-image.jpg.avif\" type=\"image/avif\"\u003e\n\t\u003csource srcset=\"/sample-image.jpg.webp\" type=\"image/webp\"\u003e\n\t\u003c!-- Default --\u003e\n\t\u003cimg src=\"/sample-image.jpg\" alt=\"Alt text\" title=\"Sample JPG\"\u003e\n\u003c/picture\u003e\n```\n\n## Screenshots\n\n### Plugin settings page\n\n![Squidge Settings Page](https://github.com/ainsleyclark/squidge/blob/master/assets/screenshot-1.png)\n\n### Example compression tab\n\n![Squidge Example Compression Tab](https://github.com/ainsleyclark/squidge/blob/master/assets/screenshot-2.png)\n\n## FAQs\n\n### Does the plugin replace existing images?\n\nYes\n\n### What are the supported operating systems?\n\nWindows, Linux, \u0026 Mac OSX.\n\n### How are JPGs optimized?\n\n```bash\njpegoptim --strip-all --overwrite --max={{ quality }} input-file.jpg\n```\n\n### How are PNGs optimized?\n\n```bash\noptipng -clobber -strip all -o {{ optimization }} input-file.jpg\n````\n\n### How are images converted to webp files?\n\n```bash\ncwebp -q {{ quality }} input-file.jpg -o input-file.jpg.webp\n```\n\n### How are images converted to avif files?\n\n```bash\navifenc --min 0 --max 63 --speed 6 -a end-usage=q -a cq-level=18 -a tune=ssim input-file.jpg input-file.jpg.avif\n```\n\n## CLI\n\nSquidge includes a built in `WP CLI` to help convert and compress images, you can see the commands below.\n\n```bash\nwp squidge\n```\n\n```bash\nusage: wp squidge health\n   or: wp squidge run\n   or: wp squidge version\n```\n\n### Version\n\nOutputs the current version number of Squidge.\n\n```bash\nwp squidge version\n```\n\n### Health\n\nChecks the correct libraries are installed.\n\n```bash\nwp squidge health\n```\n\n### Run\n\nCompresses and converts all images. This command will obtain images from the WP media library, compress them if they are\nJPG/PNG's and convert them to the `.webp` and `.avif` file formats.\n\nBy default all optimisation methods are ran, but you can disable them using the arguments below.\n\n**Simple example:**\n\n```bash\nwp squidge run\n```\n\n**With example arguments**\n\n```bash\nwp squidge run --jpeg=false --quality=80 --optimization=o3\n```\n\n#### Arguments\n\n| Argument        | Default Value | Accepted Values          | Description       |\n|-----------------|---------------| ------------------------ | ----------------- |\n| jpg             | `true`        | `true`/`false`           | If JPG compression should run.\n| png             | `true`        | `true`/`false`           | If PNG compression should run.\n| webp            | `true`        | `true`/`false`           | If WebP conversion should run.\n| avif            | `true`        | `true`/`false`           | If AVIF conversion should run.\n| quality         | `80`          | `0` to `100`             | Compression quality of the images.\n| optimization    | `02`          | `o1` to `o7`             | Optimisation of PNG images.\n| force           | `false`       | `true`/`false`           | Force reoptimization of already optimized images.\n| thumbnails-only | `false`       | `true`/`false`           | Optimize only thumbnails.\n\n## Road Map\n\n- Add `SVGO` to optimise SVG images.\n- More arguments passed to each service.\n- Update meta data when images are converted or compressed.\n- Output compression info in the Media Library.\n- Create unit tests.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fainsleyclark%2Fsquidge","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fainsleyclark%2Fsquidge","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fainsleyclark%2Fsquidge/lists"}