本文整理汇总了PHP中phpthumb_functions::SafeExec方法的典型用法代码示例。如果您正苦于以下问题:PHP phpthumb_functions::SafeExec方法的具体用法?PHP phpthumb_functions::SafeExec怎么用?PHP phpthumb_functions::SafeExec使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类phpthumb_functions
的用法示例。
在下文中一共展示了phpthumb_functions::SafeExec方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: ImageMagickThumbnailToGD
function ImageMagickThumbnailToGD()
{
// http://www.imagemagick.org/script/command-line-options.php
$this->useRawIMoutput = true;
if (phpthumb_functions::gd_version()) {
// if GD is not available, must use whatever ImageMagick can output
// $UnAllowedParameters contains options that can only be processed in GD, not ImageMagick
// note: 'fltr' *may* need to be processed by GD, but we'll check that in more detail below
$UnAllowedParameters = array('xto', 'ar', 'bg', 'bc');
// 'ra' may be part of this list, if not a multiple of 90�
foreach ($UnAllowedParameters as $parameter) {
if (isset($this->{$parameter})) {
$this->DebugMessage('$this->useRawIMoutput=false because "' . $parameter . '" is set', __FILE__, __LINE__);
$this->useRawIMoutput = false;
break;
}
}
}
$this->DebugMessage('$this->useRawIMoutput=' . ($this->useRawIMoutput ? 'true' : 'false') . ' after checking $UnAllowedParameters', __FILE__, __LINE__);
$outputFormat = $this->thumbnailFormat;
if (phpthumb_functions::gd_version()) {
if ($this->useRawIMoutput) {
switch ($this->thumbnailFormat) {
case 'gif':
$ImageCreateFunction = 'ImageCreateFromGIF';
$this->is_alpha = true;
break;
case 'png':
$ImageCreateFunction = 'ImageCreateFromPNG';
$this->is_alpha = true;
break;
case 'jpg':
case 'jpeg':
$ImageCreateFunction = 'ImageCreateFromJPEG';
break;
default:
$this->DebugMessage('Forcing output to PNG because $this->thumbnailFormat (' . $this->thumbnailFormat . ' is not a GD-supported format)', __FILE__, __LINE__);
$outputFormat = 'png';
$ImageCreateFunction = 'ImageCreateFromPNG';
$this->is_alpha = true;
$this->useRawIMoutput = false;
break;
}
if (!function_exists(@$ImageCreateFunction)) {
// ImageMagickThumbnailToGD() depends on ImageCreateFromPNG/ImageCreateFromGIF
//$this->DebugMessage('ImageMagickThumbnailToGD() aborting because '.@$ImageCreateFunction.'() is not available', __FILE__, __LINE__);
$this->useRawIMoutput = true;
//return false;
}
} else {
$outputFormat = 'png';
$ImageCreateFunction = 'ImageCreateFromPNG';
$this->is_alpha = true;
$this->useRawIMoutput = false;
}
}
// http://freealter.org/doc_distrib/ImageMagick-5.1.1/www/convert.html
if (!$this->sourceFilename && $this->rawImageData) {
$this->SourceDataToTempFile();
}
if (!$this->sourceFilename) {
$this->DebugMessage('ImageMagickThumbnailToGD() aborting because $this->sourceFilename is empty', __FILE__, __LINE__);
$this->useRawIMoutput = false;
return false;
}
if ($this->issafemode) {
$this->DebugMessage('ImageMagickThumbnailToGD() aborting because safe_mode is enabled', __FILE__, __LINE__);
$this->useRawIMoutput = false;
return false;
}
// TO BE FIXED
//if (true) {
// $this->DebugMessage('ImageMagickThumbnailToGD() aborting it is broken right now', __FILE__, __LINE__);
// $this->useRawIMoutput = false;
// return false;
//}
$commandline = $this->ImageMagickCommandlineBase();
if ($commandline) {
if ($IMtempfilename = $this->phpThumb_tempnam()) {
$IMtempfilename = realpath($IMtempfilename);
$IMuseExplicitImageOutputDimensions = false;
if ($this->ImageMagickSwitchAvailable('thumbnail') && $this->config_imagemagick_use_thumbnail) {
$IMresizeParameter = 'thumbnail';
} else {
$IMresizeParameter = 'resize';
// some (older? around 2002) versions of IM won't accept "-resize 100x" but require "-resize 100x100"
$commandline_test = $this->ImageMagickCommandlineBase() . ' logo: -resize 1x ' . escapeshellarg($IMtempfilename) . ' 2>&1';
$IMresult_test = phpthumb_functions::SafeExec($commandline_test);
$IMuseExplicitImageOutputDimensions = preg_match('#image dimensions are zero#i', $IMresult_test);
$this->DebugMessage('IMuseExplicitImageOutputDimensions = ' . intval($IMuseExplicitImageOutputDimensions), __FILE__, __LINE__);
if ($fp_im_temp = @fopen($IMtempfilename, 'wb')) {
// erase temp image so ImageMagick logo doesn't get output if other processing fails
fclose($fp_im_temp);
}
}
if (!is_null($this->dpi) && $this->ImageMagickSwitchAvailable('density')) {
// for raster source formats only (WMF, PDF, etc)
$commandline .= ' -density ' . escapeshellarg($this->dpi);
}
ob_start();
//.........这里部分代码省略.........
示例2: phpThumbDebug
function phpThumbDebug()
{
if ($this->config_disable_debug) {
return $this->ErrorImage('phpThumbDebug disabled');
}
$FunctionsExistance = array('exif_thumbnail', 'gd_info', 'image_type_to_mime_type', 'ImageCopyResampled', 'ImageCopyResized', 'ImageCreate', 'ImageCreateFromString', 'ImageCreateTrueColor', 'ImageIsTrueColor', 'ImageRotate', 'ImageTypes', 'version_compare', 'ImageCreateFromGIF', 'ImageCreateFromJPEG', 'ImageCreateFromPNG', 'ImageCreateFromWBMP', 'ImageCreateFromXBM', 'ImageCreateFromXPM', 'ImageCreateFromString', 'ImageCreateFromGD', 'ImageCreateFromGD2', 'ImageCreateFromGD2Part', 'ImageJPEG', 'ImageGIF', 'ImagePNG', 'ImageWBMP');
$ParameterNames = array('src', 'new', 'w', 'h', 'f', 'q', 'sx', 'sy', 'sw', 'sh', 'far', 'bg', 'bc', 'file', 'goto', 'err', 'xto', 'ra', 'ar', 'aoe', 'iar', 'maxb');
$OtherVariableNames = array('phpThumbDebug', 'thumbnailQuality', 'thumbnailFormat', 'gdimg_output', 'gdimg_source', 'sourceFilename', 'source_width', 'source_height', 'thumbnailCropX', 'thumbnailCropY', 'thumbnailCropW', 'thumbnailCropH', 'exif_thumbnail_width', 'exif_thumbnail_height', 'exif_thumbnail_type', 'thumbnail_width', 'thumbnail_height', 'thumbnail_image_width', 'thumbnail_image_height');
$DebugOutput = array();
$DebugOutput[] = 'phpThumb() version = ' . $this->phpthumb_version;
$DebugOutput[] = 'phpversion() = ' . @phpversion();
$DebugOutput[] = 'PHP_OS = ' . PHP_OS;
$DebugOutput[] = '__FILE__ = ' . __FILE__;
$DebugOutput[] = 'realpath(.) = ' . @realpath('.');
$DebugOutput[] = '$_SERVER[PHP_SELF] = ' . @$_SERVER['PHP_SELF'];
$DebugOutput[] = '$_SERVER[HTTP_REFERER] = ' . @$_SERVER['HTTP_REFERER'];
$DebugOutput[] = '$_SERVER[QUERY_STRING] = ' . @$_SERVER['QUERY_STRING'];
$DebugOutput[] = '$_SERVER[PATH_INFO] = ' . @$_SERVER['PATH_INFO'];
$DebugOutput[] = '$_SERVER[DOCUMENT_ROOT] = ' . @$_SERVER['DOCUMENT_ROOT'];
$DebugOutput[] = 'getenv(DOCUMENT_ROOT) = ' . @getenv('DOCUMENT_ROOT');
$DebugOutput[] = '';
$DebugOutput[] = 'get_magic_quotes_gpc() = ' . $this->phpThumbDebugVarDump(@get_magic_quotes_gpc());
$DebugOutput[] = 'get_magic_quotes_runtime() = ' . $this->phpThumbDebugVarDump(@get_magic_quotes_runtime());
$DebugOutput[] = 'error_reporting() = ' . $this->phpThumbDebugVarDump(error_reporting());
$DebugOutput[] = 'ini_get(error_reporting) = ' . $this->phpThumbDebugVarDump(@ini_get('error_reporting'));
$DebugOutput[] = 'ini_get(display_errors) = ' . $this->phpThumbDebugVarDump(@ini_get('display_errors'));
$DebugOutput[] = 'ini_get(allow_url_fopen) = ' . $this->phpThumbDebugVarDump(@ini_get('allow_url_fopen'));
$DebugOutput[] = 'ini_get(disable_functions) = ' . $this->phpThumbDebugVarDump(@ini_get('disable_functions'));
$DebugOutput[] = 'ini_get(safe_mode) = ' . $this->phpThumbDebugVarDump(@ini_get('safe_mode'));
$DebugOutput[] = 'ini_get(open_basedir) = ' . $this->phpThumbDebugVarDump(@ini_get('open_basedir'));
$DebugOutput[] = 'ini_get(memory_limit) = ' . $this->phpThumbDebugVarDump(@ini_get('memory_limit'));
$DebugOutput[] = 'ini_get(max_execution_time) = ' . $this->phpThumbDebugVarDump(@ini_get('max_execution_time'));
$DebugOutput[] = 'get_cfg_var(memory_limit) = ' . $this->phpThumbDebugVarDump(@get_cfg_var('memory_limit'));
$DebugOutput[] = 'memory_get_usage() = ' . (function_exists('memory_get_usage') ? $this->phpThumbDebugVarDump(@memory_get_usage()) : 'n/a');
$DebugOutput[] = '';
$DebugOutput[] = '$this->config_prefer_imagemagick = ' . $this->phpThumbDebugVarDump($this->config_prefer_imagemagick);
$DebugOutput[] = '$this->config_imagemagick_path = ' . $this->phpThumbDebugVarDump($this->config_imagemagick_path);
$DebugOutput[] = 'SafeExec(which convert) = ' . trim(phpthumb_functions::SafeExec('which convert'));
$IMpathUsed = $this->config_imagemagick_path ? $this->config_imagemagick_path : trim(phpthumb_functions::SafeExec('which convert'));
$DebugOutput[] = '[actual ImageMagick path used] = ' . $this->phpThumbDebugVarDump($IMpathUsed);
$DebugOutput[] = 'file_exists([actual ImageMagick path used]) = ' . $this->phpThumbDebugVarDump(file_exists($IMpathUsed));
$DebugOutput[] = 'ImageMagickVersion() = ' . $this->ImageMagickVersion();
$DebugOutput[] = '';
$DebugOutput[] = '$this->config_cache_directory = ' . $this->phpThumbDebugVarDump($this->config_cache_directory);
$DebugOutput[] = '$this->config_cache_disable_warning = ' . $this->phpThumbDebugVarDump($this->config_cache_disable_warning);
$DebugOutput[] = '$this->config_cache_maxage = ' . $this->phpThumbDebugVarDump($this->config_cache_maxage);
$DebugOutput[] = '$this->config_cache_maxsize = ' . $this->phpThumbDebugVarDump($this->config_cache_maxsize);
$DebugOutput[] = '$this->config_cache_maxfiles = ' . $this->phpThumbDebugVarDump($this->config_cache_maxfiles);
$DebugOutput[] = '$this->cache_filename = ' . $this->phpThumbDebugVarDump($this->cache_filename);
$DebugOutput[] = 'is_readable($this->config_cache_directory) = ' . $this->phpThumbDebugVarDump(is_readable($this->config_cache_directory));
$DebugOutput[] = 'is_writable($this->config_cache_directory) = ' . $this->phpThumbDebugVarDump(is_writable($this->config_cache_directory));
$DebugOutput[] = 'is_readable($this->cache_filename) = ' . $this->phpThumbDebugVarDump(is_readable($this->cache_filename));
$DebugOutput[] = 'is_writable($this->cache_filename) = ' . (file_exists($this->cache_filename) ? $this->phpThumbDebugVarDump(is_writable($this->cache_filename)) : 'n/a');
$DebugOutput[] = '';
$DebugOutput[] = '$this->config_document_root = ' . $this->phpThumbDebugVarDump($this->config_document_root);
$DebugOutput[] = '$this->config_temp_directory = ' . $this->phpThumbDebugVarDump($this->config_temp_directory);
$DebugOutput[] = '';
$DebugOutput[] = '$this->config_output_format = ' . $this->phpThumbDebugVarDump($this->config_output_format);
$DebugOutput[] = '$this->config_output_maxwidth = ' . $this->phpThumbDebugVarDump($this->config_output_maxwidth);
$DebugOutput[] = '$this->config_output_maxheight = ' . $this->phpThumbDebugVarDump($this->config_output_maxheight);
$DebugOutput[] = '';
$DebugOutput[] = '$this->config_error_message_image_default = ' . $this->phpThumbDebugVarDump($this->config_error_message_image_default);
$DebugOutput[] = '$this->config_error_bgcolor = ' . $this->phpThumbDebugVarDump($this->config_error_bgcolor);
$DebugOutput[] = '$this->config_error_textcolor = ' . $this->phpThumbDebugVarDump($this->config_error_textcolor);
$DebugOutput[] = '$this->config_error_fontsize = ' . $this->phpThumbDebugVarDump($this->config_error_fontsize);
$DebugOutput[] = '$this->config_error_die_on_error = ' . $this->phpThumbDebugVarDump($this->config_error_die_on_error);
$DebugOutput[] = '$this->config_error_silent_die_on_error = ' . $this->phpThumbDebugVarDump($this->config_error_silent_die_on_error);
$DebugOutput[] = '$this->config_error_die_on_source_failure = ' . $this->phpThumbDebugVarDump($this->config_error_die_on_source_failure);
$DebugOutput[] = '';
$DebugOutput[] = '$this->config_nohotlink_enabled = ' . $this->phpThumbDebugVarDump($this->config_nohotlink_enabled);
$DebugOutput[] = '$this->config_nohotlink_valid_domains = ' . $this->phpThumbDebugVarDump($this->config_nohotlink_valid_domains);
$DebugOutput[] = '$this->config_nohotlink_erase_image = ' . $this->phpThumbDebugVarDump($this->config_nohotlink_erase_image);
$DebugOutput[] = '$this->config_nohotlink_text_message = ' . $this->phpThumbDebugVarDump($this->config_nohotlink_text_message);
$DebugOutput[] = '';
$DebugOutput[] = '$this->config_nooffsitelink_enabled = ' . $this->phpThumbDebugVarDump($this->config_nooffsitelink_enabled);
$DebugOutput[] = '$this->config_nooffsitelink_valid_domains = ' . $this->phpThumbDebugVarDump($this->config_nooffsitelink_valid_domains);
$DebugOutput[] = '$this->config_nooffsitelink_require_refer = ' . $this->phpThumbDebugVarDump($this->config_nooffsitelink_require_refer);
$DebugOutput[] = '$this->config_nooffsitelink_erase_image = ' . $this->phpThumbDebugVarDump($this->config_nooffsitelink_erase_image);
$DebugOutput[] = '$this->config_nooffsitelink_text_message = ' . $this->phpThumbDebugVarDump($this->config_nooffsitelink_text_message);
$DebugOutput[] = '';
$DebugOutput[] = '$this->config_high_security_enabled = ' . $this->phpThumbDebugVarDump($this->config_high_security_enabled);
$DebugOutput[] = '$this->config_allow_src_above_docroot = ' . $this->phpThumbDebugVarDump($this->config_allow_src_above_docroot);
$DebugOutput[] = '$this->config_allow_src_above_phpthumb = ' . $this->phpThumbDebugVarDump($this->config_allow_src_above_phpthumb);
$DebugOutput[] = '$this->config_allow_parameter_file = ' . $this->phpThumbDebugVarDump($this->config_allow_parameter_file);
$DebugOutput[] = '$this->config_allow_parameter_goto = ' . $this->phpThumbDebugVarDump($this->config_allow_parameter_goto);
$DebugOutput[] = '';
$DebugOutput[] = '$this->config_max_source_pixels = ' . $this->phpThumbDebugVarDump($this->config_max_source_pixels);
$DebugOutput[] = '$this->config_use_exif_thumbnail_for_speed = ' . $this->phpThumbDebugVarDump($this->config_use_exif_thumbnail_for_speed);
$DebugOutput[] = '$this->config_border_hexcolor = ' . $this->phpThumbDebugVarDump($this->config_border_hexcolor);
$DebugOutput[] = '$this->config_background_hexcolor = ' . $this->phpThumbDebugVarDump($this->config_background_hexcolor);
$DebugOutput[] = '$this->config_ttf_directory = ' . $this->phpThumbDebugVarDump($this->config_ttf_directory);
$DebugOutput[] = '';
foreach ($OtherVariableNames as $varname) {
$value = $this->{$varname};
$DebugOutput[] = '$this->' . str_pad($varname, 27, ' ', STR_PAD_RIGHT) . ' = ' . $this->phpThumbDebugVarDump($value);
}
$DebugOutput[] = 'strlen($this->rawImageData) = ' . strlen(@$this->rawImageData);
$DebugOutput[] = 'strlen($this->exif_thumbnail_data) = ' . strlen(@$this->exif_thumbnail_data);
$DebugOutput[] = '';
foreach ($ParameterNames as $varname) {
//.........这里部分代码省略.........
示例3: ImageMagickThumbnailToGD
function ImageMagickThumbnailToGD()
{
// http://www.imagemagick.org/script/command-line-options.php
if (ini_get('safe_mode')) {
$this->DebugMessage('ImageMagickThumbnailToGD() aborting because safe_mode is enabled', __FILE__, __LINE__);
$this->useRawIMoutput = false;
return false;
}
$this->useRawIMoutput = true;
if (phpthumb_functions::gd_version()) {
// if GD is not available, must use whatever ImageMagick can output
// $UnAllowedParameters contains options that can only be processed in GD, not ImageMagick
// note: 'fltr' *may* need to be processed by GD, but we'll check that in more detail below
$UnAllowedParameters = array('xto', 'ar', 'bg', 'bc');
// 'ra' may be part of this list, if not a multiple of 90°
foreach ($UnAllowedParameters as $parameter) {
if (isset($this->{$parameter})) {
$this->DebugMessage('$this->useRawIMoutput=false because "' . $parameter . '" is set', __FILE__, __LINE__);
$this->useRawIMoutput = false;
break;
}
}
}
$this->DebugMessage('$this->useRawIMoutput=' . ($this->useRawIMoutput ? 'true' : 'false') . ' after checking $UnAllowedParameters', __FILE__, __LINE__);
$outputFormat = $this->thumbnailFormat;
if (phpthumb_functions::gd_version()) {
if ($this->useRawIMoutput) {
switch ($this->thumbnailFormat) {
case 'gif':
$ImageCreateFunction = 'ImageCreateFromGIF';
$this->is_alpha = true;
break;
case 'png':
$ImageCreateFunction = 'ImageCreateFromPNG';
$this->is_alpha = true;
break;
case 'jpg':
case 'jpeg':
$ImageCreateFunction = 'ImageCreateFromJPEG';
break;
default:
$this->DebugMessage('Forcing output to PNG because $this->thumbnailFormat (' . $this->thumbnailFormat . ' is not a GD-supported format)', __FILE__, __LINE__);
$outputFormat = 'png';
$ImageCreateFunction = 'ImageCreateFromPNG';
$this->is_alpha = true;
$this->useRawIMoutput = false;
break;
}
if (!function_exists(@$ImageCreateFunction)) {
// ImageMagickThumbnailToGD() depends on ImageCreateFromPNG/ImageCreateFromGIF
//$this->DebugMessage('ImageMagickThumbnailToGD() aborting because '.@$ImageCreateFunction.'() is not available', __FILE__, __LINE__);
$this->useRawIMoutput = true;
//return false;
}
} else {
$outputFormat = 'png';
$ImageCreateFunction = 'ImageCreateFromPNG';
$this->is_alpha = true;
$this->useRawIMoutput = false;
}
}
if (!$this->sourceFilename && $this->rawImageData) {
if ($IMtempSourceFilename = $this->phpThumb_tempnam()) {
$IMtempSourceFilename = realpath($IMtempSourceFilename);
$this->sourceFilename = $IMtempSourceFilename;
$this->DebugMessage('ImageMagickThumbnailToGD() setting $this->sourceFilename to "' . $IMtempSourceFilename . '" from $this->rawImageData (' . strlen($this->rawImageData) . ' bytes)', __FILE__, __LINE__);
}
}
if (!$this->sourceFilename) {
$this->DebugMessage('ImageMagickThumbnailToGD() aborting because $this->sourceFilename is empty', __FILE__, __LINE__);
$this->useRawIMoutput = false;
return false;
}
$commandline = $this->ImageMagickCommandlineBase();
if ($commandline) {
if ($IMtempfilename = $this->phpThumb_tempnam()) {
$IMtempfilename = realpath($IMtempfilename);
$IMuseExplicitImageOutputDimensions = false;
if ($this->ImageMagickSwitchAvailable('thumbnail') && $this->config_imagemagick_use_thumbnail) {
$IMresizeParameter = 'thumbnail';
} else {
$IMresizeParameter = 'resize';
// some (older? around 2002) versions of IM won't accept "-resize 100x" but require "-resize 100x100"
$commandline_test = $this->ImageMagickCommandlineBase() . ' logo: -resize 1x "' . $IMtempfilename . '" 2>&1';
$IMresult_test = phpthumb_functions::SafeExec($commandline_test);
$IMuseExplicitImageOutputDimensions = preg_match('/image dimensions are zero/i', $IMresult_test);
$this->DebugMessage('IMuseExplicitImageOutputDimensions = ' . intval($IMuseExplicitImageOutputDimensions), __FILE__, __LINE__);
if ($fp_im_temp = @fopen($IMtempfilename, 'wb')) {
// erase temp image so ImageMagick logo doesn't get output if other processing fails
fclose($fp_im_temp);
}
}
if (!is_null($this->dpi) && $this->ImageMagickSwitchAvailable('density')) {
// for raster source formats only (WMF, PDF, etc)
$commandline .= ' -density ' . $this->dpi;
}
ob_start();
$getimagesize = GetImageSize($this->sourceFilename);
$GetImageSizeError = ob_get_contents();
ob_end_clean();
//.........这里部分代码省略.........
示例4: ImageMagickThumbnailToGD
//.........这里部分代码省略.........
}
unset($this->fltr[$filterkey]);
}
}
}
break;
case 'crop':
break;
case 'sblr':
break;
case 'mean':
break;
case 'smth':
break;
case 'bvl':
break;
case 'wmi':
break;
case 'wmt':
break;
case 'over':
break;
case 'wb':
break;
case 'hist':
break;
case 'fram':
break;
case 'drop':
break;
case 'mask':
break;
case 'elip':
break;
case 'ric':
break;
}
if (!isset($this->fltr[$filterkey])) {
$this->DebugMessage('Processed $this->fltr[' . $filterkey . '] (' . $filtercommand . ') with ImageMagick', __FILE__, __LINE__);
} else {
$this->DebugMessage('Skipping $this->fltr[' . $filterkey . '] (' . $filtercommand . ') with ImageMagick', __FILE__, __LINE__);
}
}
$this->DebugMessage('Remaining $this->fltr after ImageMagick: (' . $this->phpThumbDebugVarDump($this->fltr) . ')', __FILE__, __LINE__);
if (eregi('jpe?g', $outputFormat) && $this->q) {
if ($this->ImageMagickSwitchAvailable(array('quality', 'interlace'))) {
$commandline .= ' -quality ' . $this->thumbnailQuality;
if ($this->config_output_interlace) {
// causes weird things with animated GIF... leave for JPEG only
$commandline .= ' -interlace line ';
// Use Line or Plane to create an interlaced PNG or GIF or progressive JPEG image
}
}
}
$commandline .= ' "' . str_replace('/', DIRECTORY_SEPARATOR, $this->sourceFilename) . ($outputFormat == 'gif' ? '' : '[0]') . '"';
// [0] means first frame of (GIF) animation, can be ignored
$commandline .= ' ' . $outputFormat . ':"' . $IMtempfilename . '"';
$commandline .= ' 2>&1';
$this->DebugMessage('ImageMagick called as (' . $commandline . ')', __FILE__, __LINE__);
$IMresult = phpthumb_functions::SafeExec($commandline);
//echo '<pre>';
//var_dump($commandline);
////var_dump($ImageCreateFunction);
////var_dump($IMresult);
//echo '</pre>';
//exit;
clearstatcache();
if (!@file_exists($IMtempfilename) || !@filesize($IMtempfilename)) {
$this->DebugMessage('ImageMagick failed with message (' . $IMresult . ')', __FILE__, __LINE__);
if ($this->iswindows && !$IMresult) {
$this->DebugMessage('Check to make sure that PHP has read+write permissions to "' . dirname($IMtempfilename) . '"', __FILE__, __LINE__);
}
} else {
$this->IMresizedData = file_get_contents($IMtempfilename);
if (function_exists(@$ImageCreateFunction) && ($this->gdimg_source = @$ImageCreateFunction($IMtempfilename))) {
//header('Content-Type: image/png');
//ImageSaveAlpha($this->gdimg_source, true);
//ImagePNG($this->gdimg_source);
//exit;
$this->source_width = ImageSX($this->gdimg_source);
$this->source_height = ImageSY($this->gdimg_source);
$this->DebugMessage('ImageMagickThumbnailToGD::' . $ImageCreateFunction . '() succeeded, $this->gdimg_source is now (' . $this->source_width . 'x' . $this->source_height . ')', __FILE__, __LINE__);
$this->DebugMessage('ImageMagickThumbnailToGD() returning $IMresizedData (' . strlen($this->IMresizedData) . ' bytes)', __FILE__, __LINE__);
} else {
$this->useRawIMoutput = true;
$this->DebugMessage('$this->useRawIMoutput set to TRUE because ' . @$ImageCreateFunction . '(' . $IMtempfilename . ') failed', __FILE__, __LINE__);
}
@unlink($IMtempfilename);
return true;
}
unlink($IMtempfilename);
} else {
$this->DebugMessage('ImageMagickThumbnailToGD() aborting, phpThumb_tempnam() failed', __FILE__, __LINE__);
}
} else {
$this->DebugMessage('ImageMagickThumbnailToGD() aborting because ImageMagickCommandlineBase() failed', __FILE__, __LINE__);
}
$this->useRawIMoutput = false;
return false;
}