Permalink
Browse files

bug 2672: invalid option sampling-factor for old versions of ImageMag…

…ick (use it for new versions)

git-svn-id: http://piwigo.org/svn/trunk@16230 68402e56-0260-453c-a942-63ccdbb3a9ee
  • Loading branch information...
modus75 committed Jun 30, 2012
1 parent ee4a290 commit f8ba24a7776cc746d2a75238040c73ffae199376
Showing with 10 additions and 2 deletions.
  1. +10 −2 admin/include/image.class.php
@@ -58,6 +58,7 @@ class pwg_image
var $image;
var $library = '';
var $source_filepath = '';
static $ext_imagick_version = '';
function __construct($source_filepath, $library=null)
{
@@ -339,6 +340,10 @@ static function is_ext_imagick()
@exec($conf['ext_imagick_dir'].'convert -version', $returnarray);
if (is_array($returnarray) and !empty($returnarray[0]) and preg_match('/ImageMagick/i', $returnarray[0]))
{
if (preg_match('/Version: ImageMagick (\d+\.\d+\.\d+-?\d*)/', $returnarray[0], $match))
{
self::$ext_imagick_version = $match[1];
}
return true;
}
return false;
@@ -446,7 +451,7 @@ function rotate($rotation)
function resize($width, $height)
{
$this->image->setInterlaceScheme(Imagick::INTERLACE_LINE);
// TODO need to explain this condition
if ($this->get_width()%2 == 0
&& $this->get_height()%2 == 0
@@ -613,7 +618,10 @@ function write($destination_filepath)
// to detect IM version and when we know which version supports this
// option
//
// $this->add_command('sampling-factor', '4:2:2' );
if (version_compare(pwg_image::$ext_imagick_version, '6.6') > 0)
{
$this->add_command('sampling-factor', '4:2:2' );
}
$exec = $this->imagickdir.'convert';
$exec .= ' "'.realpath($this->source_filepath).'"';

0 comments on commit f8ba24a

Please sign in to comment.