Skip to content

Instantly share code, notes, and snippets.

@maximzasorin
Last active December 25, 2015 12:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save maximzasorin/409e7e26df086045b276 to your computer and use it in GitHub Desktop.
Save maximzasorin/409e7e26df086045b276 to your computer and use it in GitHub Desktop.
Модифицированный драйвер Imagick с конвертацией изображений в sRGB (HostCMS)
<?php
/**
* Модифицированный драйвер Imagick с конвертацией изображений в sRGB
*
*/
class Core_Image_Imagicksrgb extends Core_Image
{
static public function resizeImage(/* ... */)
{
//...
// Конвертируем в sRGB
$ext = Core_File::getExtension($targetFile);
$oImagick = new Imagick($targetFile);
if ($ext == 'jpg' || $ext == 'jpeg')
{
$iccRgb = file_get_contents(CMS_FOLDER . '/hostcmsfiles/sRGB_v4_ICC_preference.icc');
$oImagick->profileImage('icc', $iccRgb);
$oImagick->writeImage($targetFile);
$oImagick->clear();
$oImagick->destroy();
}
return TRUE;
}
// ...
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment