Image Optimization via PHP

I would like to create a PHP script for optimizing images, similar to how PunyPNG or Kraken.io optimizes images. In fact, I would need to take .jpeg, .png and .gif images and minimize their file size without losing quality (or with minimal loss of quality).

These services offer an API, but I would like to avoid unnecessary costs, and I do not want to be limited to a certain number of daily applications.

Can this be done with ImageMagick? Is it possible, or is it too complicated?

+4
source share
2 answers

Basically, your easiest route is to use some command line utilities made from PHP.

Here was answered: PNG optimization tools

+2
source

speaking of recalibrating images, they were never a problem; there are several tools that can help you do this in bulk. Since you're specifically talking about PHP, I expect you to use it to display on the page. for the same purpose I wrote this little script not so long ago that can help you. Fork here https://github.com/whizzzkid/phpimageresize

+1
source

Source: https://habr.com/ru/post/1436281/


All Articles