本文整理汇总了PHP中imagick::borderImage方法的典型用法代码示例。如果您正苦于以下问题:PHP imagick::borderImage方法的具体用法?PHP imagick::borderImage怎么用?PHP imagick::borderImage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类imagick
的用法示例。
在下文中一共展示了imagick::borderImage方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: showImg
/**
* @param int $dw
* @param bool $pdfLogo
* @param int $pdfLogoSize
*/
public function showImg($dw = 500, $pdfLogo = false, $pdfLogoSize = 128)
{
$cachename = $this->fullpath . $dw . $this->pageid . ".png";
$cacheimg = $this->cachepath . '/' . $this->_nameFilter($cachename);
if (class_exists('Imagick')) {
try {
$im = $this->_dataCacher($cachename);
if ($im === false) {
$this->_logToFile('File not in cache');
$im = new imagick($this->fullpath . '[' . $this->pageid . ']');
//$im->setSize($dw*2,$dw*2);
$im->setImageFormat("png");
$im->adaptiveResizeImage($dw, $dw, true);
// add a border to the image
$color = new ImagickPixel();
$color->setColor("rgb(200,200,200)");
$im->borderImage($color, 1, 1);
// draw the PDF icon on top of the PDF preview
if ($pdfLogo) {
$pdflogo = new Imagick($this->assetsPath . $this->deficon);
$pdflogo->adaptiveResizeImage($pdfLogoSize, $pdfLogoSize);
$im->compositeImage($pdflogo, Imagick::COMPOSITE_DEFAULT, 1, 1);
}
$this->_dataCacher($cachename, $im);
$im->writeImage($cacheimg);
} else {
$this->_logToFile('File IS cached');
}
header("Content-Type: image/png");
header("Content-Disposition: attachment; filename=\"" . $cachename . ".png\";");
$this->getRawFile($cacheimg, false, 'PNG', true);
} catch (Exception $e) {
return parent::showImg($dw);
}
} else {
return parent::showImg($dw);
}
}