**Reported by plg on 21 Apr 2015 11:15**
**Version:** 2.7.4
When upload a TIFF we only get a "missing thumbnail" icon instead of the appropriate thumbnail.
[Piwigo Bugtracker #3219](http://piwigo.org/bugs/view.php?id=3219)
<!-- github-sync-id:97252356 -->
In file admin/include/image.class.php in write function in image_ext_magick
functionwrite($destination_filepath){global$conf;$this->add_command('interlace','line');// progressive rendering
// use 4:2:2 chroma subsampling (reduce file size by 20-30% with "almost" no human perception)
//
// option deactivated for Piwigo 2.4.1, it doesn't work fo old versions
// of ImageMagick, see bug:2672. To reactivate once we have a better way
// to detect IM version and when we know which version supports this
// option
//
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).'"';foreach($this->commandsas$command=>$params){$exec.=' -'.$command;if(!empty($params)){$exec.=' '.$params;}}$dest=pathinfo($destination_filepath);$tif_extension=array('tif','tiff','TIF','TIFF');if(in_array($dest['extension'],$tif_extension)){$exec.=' "'.realpath($dest['dirname']).'/'.$dest['filename'].'.'.$conf['tiff_representative_ext'].'" 2>&1';}else{$exec.=' "'.realpath($dest['dirname']).'/'.$dest['basename'].'" 2>&1';}@exec($exec,$returnarray);if(function_exists('ilog'))ilog($exec);if(is_array($returnarray)&&(count($returnarray)>0)){if(function_exists('ilog'))ilog('ERROR',$returnarray);foreach($returnarrayas$line)trigger_error($line,E_USER_WARNING);}returnis_array($returnarray);}}
In include/derivative.inc.php, SrcImage class. If $conf['picture_ext'] contains tif, tiff, TIF, TIFF extensions, displaying error occurs. With this modifcation it's ok.
function__construct($infos){global$conf;$this->id=$infos['id'];$ext=get_extension($infos['path']);$tif_ext=array('tif','tiff','TIF','TIFF');if(in_array($ext,$conf['picture_ext'])AND(!in_array($ext,$tif_ext))){$this->rel_path=$infos['path'];$this->flags|=self::IS_ORIGINAL;}elseif(!empty($infos['representative_ext'])){$this->rel_path=original_to_representative($infos['path'],$infos['representative_ext']);}else{$ext=strtolower($ext);$this->rel_path=trigger_change('get_mimetype_location',get_themeconf('mime_icon_dir').$ext.'.png',$ext);$this->flags|=self::IS_MIMETYPE;if(($size=@getimagesize(PHPWG_ROOT_PATH.$this->rel_path))===false){$this->rel_path='themes/default/icon/mimetypes/unknown.png';$size=getimagesize(PHPWG_ROOT_PATH.$this->rel_path);}$this->size=array($size[0],$size[1]);}if(!$this->size){if(isset($infos['width'])&&isset($infos['height'])){$width=$infos['width'];$height=$infos['height'];$this->rotation=intval($infos['rotation'])%4;// 1 or 5 => 90 clockwise
// 3 or 7 => 270 clockwise
if($this->rotation%2){$width=$infos['height'];$height=$infos['width'];}$this->size=array($width,$height);}elseif(!array_key_exists('width',$infos)){$this->flags|=self::DIM_NOT_GIVEN;}}}
In file admin/include/image.class.php in write function in image_ext_magick
``` php
function write($destination_filepath)
{
global $conf;
$this->add_command('interlace', 'line'); // progressive rendering
// use 4:2:2 chroma subsampling (reduce file size by 20-30% with "almost" no human perception)
//
// option deactivated for Piwigo 2.4.1, it doesn't work fo old versions
// of ImageMagick, see bug:2672. To reactivate once we have a better way
// to detect IM version and when we know which version supports this
// option
//
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).'"';
foreach ($this->commands as $command => $params)
{
$exec .= ' -'.$command;
if (!empty($params))
{
$exec .= ' '.$params;
}
}
$dest = pathinfo($destination_filepath);
$tif_extension = array('tif', 'tiff', 'TIF', 'TIFF');
if (in_array($dest['extension'], $tif_extension))
{
$exec .= ' "'.realpath($dest['dirname']).'/'.$dest['filename'].'.'.$conf['tiff_representative_ext'].'" 2>&1';
}
else
{
$exec .= ' "'.realpath($dest['dirname']).'/'.$dest['basename'].'" 2>&1';
}
@exec($exec, $returnarray);
if (function_exists('ilog')) ilog($exec);
if (is_array($returnarray) && (count($returnarray)>0) )
{
if (function_exists('ilog')) ilog('ERROR', $returnarray);
foreach($returnarray as $line)
trigger_error($line, E_USER_WARNING);
}
return is_array($returnarray);
}
}
```
In include/derivative.inc.php, SrcImage class. If $conf['picture_ext'] contains tif, tiff, TIF, TIFF extensions, displaying error occurs. With this modifcation it's ok.
``` php
function __construct($infos)
{
global $conf;
$this->id = $infos['id'];
$ext = get_extension($infos['path']);
$tif_ext = array('tif', 'tiff', 'TIF', 'TIFF');
if (in_array($ext, $conf['picture_ext']) AND (!in_array($ext, $tif_ext)))
{
$this->rel_path = $infos['path'];
$this->flags |= self::IS_ORIGINAL;
}
elseif (!empty($infos['representative_ext']))
{
$this->rel_path = original_to_representative($infos['path'], $infos['representative_ext']);
}
else
{
$ext = strtolower($ext);
$this->rel_path = trigger_change('get_mimetype_location', get_themeconf('mime_icon_dir').$ext.'.png', $ext );
$this->flags |= self::IS_MIMETYPE;
if ( ($size=@getimagesize(PHPWG_ROOT_PATH.$this->rel_path)) === false)
{
$this->rel_path = 'themes/default/icon/mimetypes/unknown.png';
$size = getimagesize(PHPWG_ROOT_PATH.$this->rel_path);
}
$this->size = array($size[0],$size[1]);
}
if (!$this->size)
{
if (isset($infos['width']) && isset($infos['height']))
{
$width = $infos['width'];
$height = $infos['height'];
$this->rotation = intval($infos['rotation']) % 4;
// 1 or 5 => 90 clockwise
// 3 or 7 => 270 clockwise
if ($this->rotation % 2)
{
$width = $infos['height'];
$height = $infos['width'];
}
$this->size = array($width, $height);
}
elseif (!array_key_exists('width', $infos))
{
$this->flags |= self::DIM_NOT_GIVEN;
}
}
}
```
<!-- github-comment-id:140373076 -->
I have made another test on Piwigo 2.7 and I can't reproduce any problem. If you have $conf['graphics_library'] = 'ext_imagick'; then a pwg_representative will be created during upload and Piwigo will generate the thumbnail from it.
I have made another test on Piwigo 2.7 and I can't reproduce any problem. If you have $conf['graphics_library'] = 'ext_imagick'; then a pwg_representative will be created during upload and Piwigo will generate the thumbnail from it.
<!-- github-comment-id:164549401 -->
Sorry to reply so late. I did a test with the new version 2.8 and I still have the same error for the generation of thumbnail tiff formats.
Sample video : http://blogoflip.fr/mespartages/index.php/s/VrRZzwwOqfstpkd
<!-- github-comment-id:194324518 -->
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Reported by plg on 21 Apr 2015 11:15
Version: 2.7.4
When upload a TIFF we only get a "missing thumbnail" icon instead of the appropriate thumbnail.
Piwigo Bugtracker #3219
In file admin/include/image.class.php in write function in image_ext_magick
In include/derivative.inc.php, SrcImage class. If $conf['picture_ext'] contains tif, tiff, TIF, TIFF extensions, displaying error occurs. With this modifcation it's ok.
I just made a new test (on current git master) and the problem does not occur. I have to make so more tests.
I have made another test on Piwigo 2.7 and I can't reproduce any problem. If you have $conf['graphics_library'] = 'ext_imagick'; then a pwg_representative will be created during upload and Piwigo will generate the thumbnail from it.
As I can't reproduce the bug on Git master, I close this issue.
Sorry to reply so late. I did a test with the new version 2.8 and I still have the same error for the generation of thumbnail tiff formats.
Sample video : http://blogoflip.fr/mespartages/index.php/s/VrRZzwwOqfstpkd