本文整理汇总了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();
//.........这里部分代码省略.........