Tag Archives: image compression in PHP

How to compress an image using imagemagick in PHP?

(first instal imagemagick into the server, then it will set the path as follows) $imagemagicpath=’usr/bin’ //usualy this is the path for image magick $source=’images/first.jpg’; //first.jpg is renamed to converted.jpg //Specifying destination path $destination=’images/converted.jpg’; //path for imagemagic function //specify quality here $cmd=$imagemagicpath.”/convert “.$source.” -quality 10% “.$destination; //above line is executing here exec($cmd); this will reduce the… Read More »