本文整理汇总了PHP中Image_Canvas::image方法的典型用法代码示例。如果您正苦于以下问题:PHP Image_Canvas::image方法的具体用法?PHP Image_Canvas::image怎么用?PHP Image_Canvas::image使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Image_Canvas
的用法示例。
在下文中一共展示了Image_Canvas::image方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: image
/**
* Overlay image
*
* Parameter array:
* 'x': int X-point of overlayed image
* 'y': int Y-point of overlayed image
* 'filename': string The filename of the image to overlay
* 'width': int [optional] The width of the overlayed image (resizing if possible)
* 'height': int [optional] The height of the overlayed image (resizing if possible)
* 'alignment': array [optional] Alignment
*/
function image($params)
{
if (isset($this->_imageMap)) {
$this->_imageMap->image($params);
}
parent::image($params);
}
示例2: image
/**
* Overlay image
*
* Parameter array:
* 'x': int X-point of overlayed image
* 'y': int Y-point of overlayed image
* 'filename': string The filename of the image to overlay
* 'width': int [optional] The width of the overlayed image (resizing if possible)
* 'height': int [optional] The height of the overlayed image (resizing if possible)
* 'alignment': array [optional] Alignment
*/
function image($params)
{
$x = $this->_getX($params['x']);
$y = $this->_getY($params['y']);
$filename = $params['filename'];
list($width, $height, $type, $attr) = getimagesize($filename);
$width = isset($params['width']) ? $params['width'] : $width;
$height = isset($params['height']) ? $params['height'] : $height;
$alignment = isset($params['alignment']) ? $params['alignment'] : false;
$file = fopen($filename, 'rb');
$filedata = fread($file, filesize($filename));
fclose($file);
$data = 'data:' . image_type_to_mime_type($type) . ';base64,' . base64_encode($filedata);
$this->_addElement('<image xlink:href="' . $data . '" x="' . $x . '" y="' . $y . '"' . ($width ? ' width="' . $width . '"' : '') . ($height ? ' height="' . $height . '"' : '') . ' preserveAspectRatio="none"/>', $params);
parent::image($params);
}
示例3: image
/**
* Overlay image
*
* Parameter array:
* 'x': int X-point of overlayed image
* 'y': int Y-point of overlayed image
* 'filename': string The filename of the image to overlay
* 'width': int [optional] The width of the overlayed image (resizing if possible)
* 'height': int [optional] The height of the overlayed image (resizing if possible)
* 'alignment': array [optional] Alignment
*/
function image($params)
{
$x = $this->_getX($params['x']);
$y = $this->_getY($params['y']);
$filename = $params['filename'];
$width = isset($params['width']) ? $params['width'] : false;
$height = isset($params['height']) ? $params['height'] : false;
$alignment = isset($params['alignment']) ? $params['alignment'] : false;
if (substr($filename, -4) == '.png') {
$type = 'png';
} elseif (substr($filename, -4) == '.jpg') {
$type = 'jpeg';
}
$image = pdf_load_image($this->_pdf, $type, realpath($filename), '');
$width_ = pdf_get_value($this->_pdf, 'imagewidth', $image);
$height_ = pdf_get_value($this->_pdf, 'imageheight', $image);
$outputWidth = $width !== false ? $width : $width_;
$outputHeight = $height !== false ? $height : $height_;
if (!is_array($alignment)) {
$alignment = array('vertical' => 'top', 'horizontal' => 'left');
}
if (!isset($alignment['vertical'])) {
$alignment['vertical'] = 'top';
}
if (!isset($alignment['horizontal'])) {
$alignment['horizontal'] = 'left';
}
if ($alignment['horizontal'] == 'right') {
$x -= $outputWidth;
} elseif ($alignment['horizontal'] == 'center') {
$x -= $outputWidth / 2;
}
if ($alignment['vertical'] == 'top') {
$y += $outputHeight;
} elseif ($alignment['vertical'] == 'center') {
$y += $outputHeight / 2;
}
if ($width === false && $height === false) {
$scale = 1;
} else {
$scale = max($height / $height_, $width / $width_);
}
pdf_place_image($this->_pdf, $image, $this->_getX($x), $this->_getY($y), $scale);
pdf_close_image($this->_pdf, $image);
parent::image($params);
}
示例4: image
/**
* Overlay image
*
* Parameter array:
* 'x' : int X-point of overlayed image
* 'y' : int Y-point of overlayed image
* 'filename' : string The filename of the image to overlay
* 'width' : int [optional] The width of the overlayed image (resizing if possible)
* 'height' : int [optional] The height of the overlayed image (resizing if possible)
* 'alignment' : array [optional] Alignment
* 'url' : string [optional] Target URL
*
* @param array $params Parameter array
*
* @return void
*/
function image($params)
{
parent::image($params);
}