Last active
August 25, 2018 14:14
-
-
Save aktaumag/d4ecbf53d3b9de0f335c2e7a7d549583 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Оптимизация автогенерирующихся картинок | |
*/ | |
imagejpeg($this->image, $file, $quality); | |
// WebSEO.kz START add: После сохранения превьюшки в формате jpg/jpeg, оптимизируем файл классом Imagick | |
// Create new imagick object | |
$im = new Imagick($file); | |
// Optimize the image layers | |
$im->optimizeImageLayers(); | |
// Compression and quality | |
$im->setImageCompression(Imagick::COMPRESSION_JPEG); | |
$im->setImageCompressionQuality(50); | |
// Write the image back | |
$im->writeImages($file, true); | |
// WS WebSEO END | |
// WebSEO.kz edit: При сохранении превьюшки в формате png, можно сразу оптимизировать указав сжалие и отключение фильтров | |
// imagepng($this->image, $file); | |
imagepng($this->image, $file, 5, PNG_NO_FILTER ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
// imagejpeg($image); // WebSEO.kz Michael Nossov меняю вывод картинки, чтобы выводить оптимизированное изображение
imagepng($image, null, 5, PNG_NO_FILTER );