Search code examples
phpimagemagickgdpagespeed

PHP - how to generate optimized jpg images for PageSpeed Insights?


I have several files, I want to make them optimized images for PageSpeed Insights. How to do this with PHP using gd or imagemagick?


Solution

  • When you upload an image process it with the function bellow. This process cleans meta information from images and stop Google for being annoying.

    $im = imagecreatefromjpeg($target_file);
    

    Source: http://php.net/manual/ro/function.imagecreatefromjpeg.php