#48 WMI with 300 DPI JPEG

open
nobody
None
5
2012-12-06
2007-11-13
PiercedMedia
No

Running phpThumb 1.7.8
PHP 5.1.6
GD 2.1.9

Using the following function for easy repititious use:
function CreateThumbnail($file,$new_file,$new_file_format='jpg',$max_width=0,$max_height=0,$zoom_crop=0,$watermark_file="")
{
require_once($_SERVER['DOCUMENT_ROOT']."/phpthumb/phpthumb.class.php");
$phpThumb = new phpThumb();
$phpThumb->setSourceFilename($file);
if($max_width>0)
{
$phpThumb->setParameter('w', $max_width);
}
if($max_height>0)
{
$phpThumb->setParameter('h', $max_height);
}
$phpThumb->setParameter('config_output_format', $new_file_format);
$phpThumb->setParameter('config_imagemagick_path', '/usr/bin/convert');
$phpThumb->setParameter('config_prefer_imagemagick', true);
$phpThumb->setParameter('config_allow_src_above_docroot', true);
$phpThumb->setParameter('zc', $zoom_crop);
if($watermark_file != "")
{
$phpThumb->setParameter('fltr', 'wmi|'.$watermark_file.'|*|20');
}
$output_filename = $new_file.".".$phpThumb->config_output_format;
if ($phpThumb->GenerateThumbnail())
{
if ($output_filename)
{
if ($phpThumb->RenderToFile($output_filename))
{
//success...do nothing
}
else
{
//error...do nothing
}
}
else
{
$phpThumb->OutputThumbnail();
}
}
unset($phpThumb);
}

The function works properly as far as I can tell will all images if no watermark image is specified, and will properly apply the watermark as long as the uploaded image is set at 72 dpi (the watermark is already a 72 dpi image). Uploading a 300 dpi jpeg causes an execution time exceeded error in my error log. I did not try any other file format.

Discussion