本文整理匯總了PHP中phpthumb_functions::escapeshellarg_replacement方法的典型用法代碼示例。如果您正苦於以下問題:PHP phpthumb_functions::escapeshellarg_replacement方法的具體用法?PHP phpthumb_functions::escapeshellarg_replacement怎麽用?PHP phpthumb_functions::escapeshellarg_replacement使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類phpthumb_functions
的用法示例。
在下文中一共展示了phpthumb_functions::escapeshellarg_replacement方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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 = $this->realPathSafe($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 ' . phpthumb_functions::escapeshellarg_replacement($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 ' . phpthumb_functions::escapeshellarg_replacement($this->dpi);
}
ob_start();
//.........這裏部分代碼省略.........