Download the PHP package typisttech/image-optimize-command without Composer

On this page you can find all versions of the php package typisttech/image-optimize-command. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package image-optimize-command

# Image Optimize Command
[![Packagist](https://img.shields.io/packagist/v/typisttech/image-optimize-command.svg?style=flat-square)](https://packagist.org/packages/typisttech/image-optimize-command) [![Packagist](https://img.shields.io/packagist/dt/typisttech/image-optimize-command.svg?style=flat-square)](https://packagist.org/packages/typisttech/image-optimize-command) ![PHP from Packagist](https://img.shields.io/packagist/php-v/TypistTech/image-optimize-command?style=flat-square) [![CircleCI](https://img.shields.io/circleci/build/gh/TypistTech/image-optimize-command?style=flat-square)](https://circleci.com/gh/TypistTech/image-optimize-command) [![Codecov](https://img.shields.io/codecov/c/gh/TypistTech/image-optimize-command?style=flat-square)](https://codecov.io/gh/TypistTech/image-optimize-command) [![license](https://img.shields.io/github/license/TypistTech/image-optimize-command.svg?style=flat-square)](https://github.com/TypistTech/image-optimize-command/blob/master/LICENSE) [![Twitter Follow @TangRufus](https://img.shields.io/twitter/follow/TangRufus?style=flat-square&color=1da1f2&logo=twitter)](https://twitter.com/tangrufus) [![Hire Typist Tech](https://img.shields.io/badge/Hire-Typist%20Tech-ff69b4.svg?style=flat-square)](https://www.typist.tech/contact/)

Easily optimize images using WP CLI

Built with ♥ by Typist Tech


Image Optimize Command is an open source project and completely free to use.

However, the amount of effort needed to maintain and develop new features is not sustainable without proper financial backing. If you have the capability, please consider donating using the links below:

[![GitHub via Sponsor](https://img.shields.io/badge/Sponsor-GitHub-ea4aaa?style=flat-square&logo=github)](https://github.com/sponsors/TangRufus) [![Sponsor via PayPal](https://img.shields.io/badge/Sponsor-PayPal-blue.svg?style=flat-square&logo=paypal)](https://typist.tech/go/paypal-donate/) [![More Sponsorship Information](https://img.shields.io/badge/Sponsor-More%20Details-ff69b4?style=flat-square)](https://typist.tech/donate/image-optimize-command/)

Image Optimize Command is a WP CLI wrapper for spatie/image-optimizer which optimize gif, jpeg, jpg, png, svg, webp images by running them through a chain of various image optimization tools. Read the introductory blog post about why I built it.

Usage


Typist Tech is ready to build your next awesome WordPress site. Hire us!


Requirements

Since wp-cli/wp-cli-bundle bundles an older version of symfony/process which incompatible with spatie/image-optimizer, WP-CLI must be installed via composer.

Installation

Optimization tools

Under the hood, image-optimize-command invokes spatie/image-optimizer which requires these binaries installed:

Check spatie/image-optimizer's readme for install instructions.

SVGO and cwebp are optional

Note that WordPress doesn't support svg files out of the box. You can omit SVGO. However, if you have enabled WordPress svg support and uploaded svg files to WordPress media library, you must install SVGO. Otherwise, the command will fail.

Same goes for cwebp.

Use Cases

First use

This command optimize both the full sized image(the one you uploaded) and the thumbnails(WordPress auto-resize these images for you).

Chances are the thumbnails are missing or never generated:

Simplest solution is to regenerate thumbnails then optimize:

After upgrading WordPress core / plugins / themes

Restoring the originals

This command backs up the full sized images before optimizing attachments. If you want to restore them:

Migrating from image-optimize-command v0.1.x

Starting from v0.2, this command backs up the full sized images before optimizing attachments. To migrate from image-optimize-command v0.1.x:

FAQs

What kind of optimization it does?

Mostly applying compression, removing metadata and reducing the number of colors to gif, jpeg, jpg, png, svg, webp images. The package is smart enough pick the right tool for the right image.

Check Freek Van der Herten's article explaining spatie/image-optimizer's sane default configuration.

How to customize the optimization?

How to skip backups / restorations?

:warning: The optimzation is lossy. If you skip backing up the original files, there is no way to recover the original files. Proceed with caution.

It would be nice to have those 2 null operations in a separate package. Submit pull requests to mention it in this readme if you have implemented it.

Does running wp image-optimize attachment / batch multiple times trigger multiple optimization for the same attachments?

No.

By default, boolean flags (meta fields) are given to attachments after optimization. This is to prevent re-optimizing an already optimized attachment. If you changed the image files (e.g.: resize / regenerate thumbnail), you must first reset their meta flags.

Note: The find subcommand and its shortcuts don't create meta flags.

Will the images look different after optimization?

Yes, a little bit. This is lossy optimization. However, you won't notice the difference unless you have a trained eye for that.

See spatie/image-optimizer's readme on binary options used.

Why my GIFs stopped animating?

When you upload an image using the media uploader, WordPress automatically creates several copies of that image in different sizes...When creating new image sizes for animated GIFs, WordPress ends up saving only the first frame of the GIF...

--- wpbeginner

Luckily for you, Lasse M. Tvedt showed how to stop WordPress from resizing GIFs on StackExchange.

Can I use this on managed hosting?

No, you can't use this on managed hosting such as Kinsta, Flywheel or WP Engine because they prohibit installing the binaries.

If you must use it on managed hosting, hire a developer to add SaaS provider integration:

Do I have to install SVGO or cwebp?

No, if you don't have any svg files in WordPress media library.

Yes, if you have:

Same goes for cwebp.

PHP Fatal error: Allowed memory size of 999999 bytes exhausted (tried to allocate 99 bytes)

This is a common WP CLI issue. See: https://bit.ly/wpclimem

Does it have a limits or quotas?

No, unlike other SaaS alternatives, this package runs on your server without any limitation on file sizes or a monthly quota. Totally free of charge.

Is it for everyone?

No, it comes at a cost. Optimization is CPU intensive. Expect CPU usage rockets up to 100% during optimization. Schedule it to run at late night in small batches.

Learn more on this article.

Will you add support for older PHP versions?

Never! This plugin will only work on actively supported PHP versions.

Don't use it on end of life or security fixes only PHP versions.

It looks awesome. Where can I find some more goodies like this

Where can I give 5-star reviews?

Thanks! Glad you like it. It's important to let me knows somebody is using this project. Please consider:

Testing

Run the tests:

Feedback

Please provide feedback! We want to make this project as useful as possible. Please submit an issue and point out what you do and don't like, or fork the project and send pull requests. No issue is too small.

Security Vulnerabilities

If you discover a security vulnerability within this project, please email us at [email protected]. All security vulnerabilities will be promptly addressed.

Credits

Image Optimize Command is a Typist Tech project and maintained by Tang Rufus, freelance developer for hire.

Special thanks to Freek Van der Herten whose spatie/image-optimizer package makes this project possible.

Full list of contributors can be found here.

License

Image Optimize Command is released under the MIT License.


All versions of image-optimize-command with dependencies

PHP Build Version
Package Version
Requires php Version ^7.2
psr/log Version ^1.1
spatie/image-optimizer Version ^1.2
symfony/filesystem Version ^4.3 || ^5.0
symfony/finder Version ^4.3 || ^5.0
wp-cli/wp-cli Version ^2.3
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package typisttech/image-optimize-command contains the following files

Loading the files please wait ....