本文整理匯總了PHP中phpthumb_functions::SanitizeFilename方法的典型用法代碼示例。如果您正苦於以下問題:PHP phpthumb_functions::SanitizeFilename方法的具體用法?PHP phpthumb_functions::SanitizeFilename怎麽用?PHP phpthumb_functions::SanitizeFilename使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類phpthumb_functions
的用法示例。
在下文中一共展示了phpthumb_functions::SanitizeFilename方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: SendSaveAsFileHeaderIfNeeded
function SendSaveAsFileHeaderIfNeeded() {
if (headers_sent()) {
return false;
}
global $phpThumb;
$downloadfilename = phpthumb_functions::SanitizeFilename(@$_GET['sia'] ? $_GET['sia'] : (@$_GET['down'] ? $_GET['down'] : 'phpThumb_generated_thumbnail'.(@$_GET['f'] ? $_GET['f'] : 'jpg')));
if (@$downloadfilename) {
$phpThumb->DebugMessage('SendSaveAsFileHeaderIfNeeded() sending header: Content-Disposition: '.(@$_GET['down'] ? 'attachment' : 'inline').'; filename="'.$downloadfilename.'"', __FILE__, __LINE__);
header('Content-Disposition: '.(@$_GET['down'] ? 'attachment' : 'inline').'; filename="'.$downloadfilename.'"');
}
return true;
}
示例2: OutputThumbnail
function OutputThumbnail()
{
$this->purgeTempFiles();
if (!$this->useRawIMoutput && !is_resource($this->gdimg_output)) {
$this->DebugMessage('OutputThumbnail() failed because !is_resource($this->gdimg_output)', __FILE__, __LINE__);
return false;
}
if (headers_sent()) {
return $this->ErrorImage('OutputThumbnail() failed - headers already sent');
exit;
}
$downloadfilename = phpthumb_functions::SanitizeFilename(is_string($this->sia) ? $this->sia : ($this->down ? $this->down : 'phpThumb_generated_thumbnail' . '.' . $this->thumbnailFormat));
$this->DebugMessage('Content-Disposition header filename set to "' . $downloadfilename . '"', __FILE__, __LINE__);
if ($downloadfilename) {
header('Content-Disposition: ' . ($this->down ? 'attachment' : 'inline') . '; filename="' . $downloadfilename . '"');
} else {
$this->DebugMessage('failed to send Content-Disposition header because $downloadfilename is empty', __FILE__, __LINE__);
}
if ($this->useRawIMoutput) {
header('Content-Type: ' . phpthumb_functions::ImageTypeToMIMEtype($this->thumbnailFormat));
echo $this->IMresizedData;
} else {
$this->DebugMessage('ImageInterlace($this->gdimg_output, ' . intval($this->config_output_interlace) . ')', __FILE__, __LINE__);
ImageInterlace($this->gdimg_output, intval($this->config_output_interlace));
switch ($this->thumbnailFormat) {
case 'jpeg':
header('Content-Type: ' . phpthumb_functions::ImageTypeToMIMEtype($this->thumbnailFormat));
$ImageOutFunction = 'image' . $this->thumbnailFormat;
@$ImageOutFunction($this->gdimg_output, '', $this->thumbnailQuality);
break;
case 'png':
case 'gif':
header('Content-Type: ' . phpthumb_functions::ImageTypeToMIMEtype($this->thumbnailFormat));
$ImageOutFunction = 'image' . $this->thumbnailFormat;
@$ImageOutFunction($this->gdimg_output);
break;
case 'bmp':
if (!@(include_once dirname(__FILE__) . '/phpthumb.bmp.php')) {
$this->DebugMessage('Error including "' . dirname(__FILE__) . '/phpthumb.bmp.php" which is required for BMP format output', __FILE__, __LINE__);
return false;
}
$phpthumb_bmp = new phpthumb_bmp();
if (is_object($phpthumb_bmp)) {
$bmp_data = $phpthumb_bmp->GD2BMPstring($this->gdimg_output);
unset($phpthumb_bmp);
if (!$bmp_data) {
$this->DebugMessage('$phpthumb_bmp->GD2BMPstring() failed', __FILE__, __LINE__);
return false;
}
header('Content-Type: ' . phpthumb_functions::ImageTypeToMIMEtype($this->thumbnailFormat));
echo $bmp_data;
} else {
$this->DebugMessage('new phpthumb_bmp() failed', __FILE__, __LINE__);
return false;
}
break;
case 'ico':
if (!@(include_once dirname(__FILE__) . '/phpthumb.ico.php')) {
$this->DebugMessage('Error including "' . dirname(__FILE__) . '/phpthumb.ico.php" which is required for ICO format output', __FILE__, __LINE__);
return false;
}
$phpthumb_ico = new phpthumb_ico();
if (is_object($phpthumb_ico)) {
$arrayOfOutputImages = array($this->gdimg_output);
$ico_data = $phpthumb_ico->GD2ICOstring($arrayOfOutputImages);
unset($phpthumb_ico);
if (!$ico_data) {
$this->DebugMessage('$phpthumb_ico->GD2ICOstring() failed', __FILE__, __LINE__);
return false;
}
header('Content-Type: ' . phpthumb_functions::ImageTypeToMIMEtype($this->thumbnailFormat));
echo $ico_data;
} else {
$this->DebugMessage('new phpthumb_ico() failed', __FILE__, __LINE__);
return false;
}
break;
default:
$this->DebugMessage('OutputThumbnail failed because $this->thumbnailFormat "' . $this->thumbnailFormat . '" is not valid', __FILE__, __LINE__);
return false;
break;
}
}
return true;
}