本文整理汇总了PHP中QApplication::CacheControl方法的典型用法代码示例。如果您正苦于以下问题:PHP QApplication::CacheControl方法的具体用法?PHP QApplication::CacheControl怎么用?PHP QApplication::CacheControl使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QApplication
的用法示例。
在下文中一共展示了QApplication::CacheControl方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: RenderImage
//.........这里部分代码省略.........
} else {
// Step 2 - Alignment
switch ($this->strVerticalAlign) {
case QVerticalAlign::Top:
if ($blnTrueType) {
$intY = $intBoxHeight - $intYCoordinate2 + $this->intPaddingHeight;
} else {
$intY = $intYCoordinate2 + 2 + $this->intPaddingHeight;
}
break;
case QVerticalAlign::Bottom:
if ($blnTrueType) {
$intY = $this->strHeight - $intYCoordinate2 - $this->intPaddingHeight;
} else {
$intY = $this->strHeight + $intYCoordinate1 - 2 - $this->intPaddingHeight;
}
break;
case QVerticalAlign::Middle:
if ($blnTrueType) {
$intY = round(($this->strHeight - $intBoxHeight) / 2) + $intBoxHeight - $intYCoordinate2;
} else {
$intY = round(($this->strHeight - $intBoxHeight) / 2) + $intYCoordinate2;
}
break;
// Step 3 - Use Coordinates
// Step 3 - Use Coordinates
default:
$intY = $this->intYCoordinate;
break;
}
$intHeight = $this->strHeight;
}
if ($intWidth <= 0) {
$intWidth = 100;
}
if ($intHeight <= 0) {
$intHeight = 100;
}
$objImage = imagecreate($intWidth, $intHeight);
// Define Colors
$intRed = hexdec(substr($this->strBackColor, 0, 2));
$intGreen = hexdec(substr($this->strBackColor, 2, 2));
$intBlue = hexdec(substr($this->strBackColor, 4));
$clrBackground = imagecolorallocate($objImage, $intRed, $intGreen, $intBlue);
$intRed = hexdec(substr($this->strForeColor, 0, 2));
$intGreen = hexdec(substr($this->strForeColor, 2, 2));
$intBlue = hexdec(substr($this->strForeColor, 4));
$clrForeground = imagecolorallocate($objImage, $intRed, $intGreen, $intBlue);
if ($this->blnBackgroundTransparent) {
imagecolortransparent($objImage, $clrBackground);
}
imagefilledrectangle($objImage, 0, 0, $intWidth, $intHeight, $clrBackground);
if ($blnTrueType) {
imagettftext($objImage, $this->strFontSize, $this->intAngle, $intX, $intY, $clrForeground, $strFontPath, $this->strText);
} else {
// Anti Aliasing
if ($this->blnSmoothFont) {
$intAntiAliasing = 16;
} else {
$intAntiAliasing = 4;
}
// Draw Text and Free Font
imagepstext($objImage, $this->strText, $objFont, $this->strFontSize, $clrForeground, $clrBackground, $intX, $intY, $this->intSpace, $this->intTightness, $this->intAngle, $intAntiAliasing);
imagepsfreefont($objFont);
}
// Output the Image (if path isn't specified, output to buffer. Otherwise, output to disk)
if (!$strPath) {
// TODO: Update Cache Parameters
QApplication::$CacheControl = 'cache';
header('Expires: Wed, 20 Mar 2019 05:00:00 GMT');
header('Pragma: cache');
switch ($this->strImageType) {
case QImageType::Gif:
header('Content-type: image/gif');
imagegif($objImage);
break;
case QImageType::Jpeg:
header('Content-type: image/jpeg');
imagejpeg($objImage, null, $this->intQuality);
break;
default:
header('Content-type: image/png');
imagepng($objImage);
break;
}
} else {
switch ($this->strImageType) {
case QImageType::Gif:
imagegif($objImage, $strPath);
break;
case QImageType::Jpeg:
imagejpeg($objImage, $strPath, $this->intQuality);
break;
default:
imagepng($objImage, $strPath);
break;
}
}
imagedestroy($objImage);
}
示例2: SetupContentType
protected function SetupContentType()
{
// TODO: Update Cache Parameters
QApplication::$CacheControl = 'cache';
header('Expires: Wed, 20 Mar 2019 05:00:00 GMT');
header('Pragma: cache');
if (!($strImageType = $this->strImageType)) {
$strImageType = $this->strSourceImageType;
}
switch ($strImageType) {
case QImageType::Jpeg:
case QImageType::Png:
case QImageType::Gif:
header('Content-Type: image/' . $strImageType);
break;
default:
throw new Exception('Invalid Image Type');
}
}
示例3: RenderImageMagickHelper
/**
* Used by custom RenderImage method to output the final image.
* Uses $this->strImageType to determine type of image to be rendered.
* This version is to be used when rendering an image using the Imagick library.
*
* If strPath is not set, output to the screen. If it is, save to strPath.
*
* @param Imagick $objFinalImage image as an instance of the Imagick class
* @param string $strPath
*/
protected function RenderImageMagickHelper($objFinalImage, $strPath)
{
// Output the Image (if path isn't specified, output to buffer. Otherwise, output to disk)
if (!$strPath) {
$strPath = $this->strImagickTempFilePath . '/image_' . str_replace('.', '_', microtime(true));
// Output to a temporary location
switch ($this->strImageType) {
case QImageType::Gif:
$strPath .= '.gif';
$objFinalImage->setImageFormat('gif');
header('Content-Type: image/gif');
break;
case QImageType::AnimatedGif:
$strPath .= '.gif';
$objFinalImage->setImageFormat('gif');
header('Content-Type: image/gif');
break;
case QImageType::Jpeg:
$strPath .= '.jpg';
$objFinalImage->setImageFormat('jpeg');
$objFinalImage->setCompressionQuality($this->intJpegQuality);
header('Content-Type: image/jpeg');
break;
default:
$strPath .= '.png';
$objFinalImage->setImageFormat('png');
header('Content-Type: image/png');
break;
}
if ($this->strImageType == QImageType::AnimatedGif) {
file_put_contents($strPath, $objFinalImage->GetImagesBlob());
} else {
$objFinalImage->writeImage($strPath);
}
QApplication::$CacheControl = 'cache';
header('Expires: Wed, 20 Mar 2019 05:00:00 GMT');
header('Pragma: cache');
print file_get_contents($strPath);
unlink($strPath);
} else {
// Make Directory
QApplication::MakeDirectory(dirname($strPath), 0777);
// Output to Disk
switch ($this->strImageType) {
case QImageType::Gif:
$objFinalImage->setImageFormat('gif');
break;
case QImageType::AnimatedGif:
$objFinalImage->setImageFormat('gif');
break;
case QImageType::Jpeg:
$objFinalImage->setImageFormat('jpeg');
$objFinalImage->setCompressionQuality($this->intJpegQuality);
break;
default:
$objFinalImage->setImageFormat('png');
break;
}
$objFinalImage->writeImage($strPath);
chmod($strPath, 0777);
}
$objFinalImage->Destroy();
}