本文整理汇总了PHP中TCPDF_IMAGES::setGDImageTransparency方法的典型用法代码示例。如果您正苦于以下问题:PHP TCPDF_IMAGES::setGDImageTransparency方法的具体用法?PHP TCPDF_IMAGES::setGDImageTransparency怎么用?PHP TCPDF_IMAGES::setGDImageTransparency使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TCPDF_IMAGES
的用法示例。
在下文中一共展示了TCPDF_IMAGES::setGDImageTransparency方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Image
//.........这里部分代码省略.........
return $this->Image($tempfile_plain, $x, $y, $w, $h, $type, $link, $align, $resize, $dpi, $palign, false, $imgmask);
}
}
}
if ($newimage) {
//First use of image, get info
$type = strtolower($type);
if ($type == '') {
$type = TCPDF_IMAGES::getImageFileType($file, $imsize);
} elseif ($type == 'jpg') {
$type = 'jpeg';
}
$mqr = TCPDF_STATIC::get_mqr();
TCPDF_STATIC::set_mqr(false);
// Specific image handlers (defined on TCPDF_IMAGES CLASS)
$mtd = '_parse' . $type;
// GD image handler function
$gdfunction = 'imagecreatefrom' . $type;
$info = false;
if (method_exists('TCPDF_IMAGES', $mtd) and !($resize and (function_exists($gdfunction) or extension_loaded('imagick')))) {
// TCPDF image functions
$info = TCPDF_IMAGES::$mtd($file);
if ($info === 'pngalpha' or isset($info['trns']) and !empty($info['trns'])) {
return $this->ImagePngAlpha($file, $x, $y, $pixw, $pixh, $w, $h, 'PNG', $link, $align, $resize, $dpi, $palign, $filehash);
}
}
if ($info === false and function_exists($gdfunction)) {
try {
// GD library
$img = $gdfunction($file);
if ($resize) {
$imgr = imagecreatetruecolor($neww, $newh);
if ($type == 'gif' or $type == 'png') {
$imgr = TCPDF_IMAGES::setGDImageTransparency($imgr, $img);
}
imagecopyresampled($imgr, $img, 0, 0, 0, 0, $neww, $newh, $pixw, $pixh);
if ($type == 'gif' or $type == 'png') {
$info = TCPDF_IMAGES::_toPNG($imgr);
} else {
$info = TCPDF_IMAGES::_toJPEG($imgr, $this->jpeg_quality);
}
} else {
if ($type == 'gif' or $type == 'png') {
$info = TCPDF_IMAGES::_toPNG($img);
} else {
$info = TCPDF_IMAGES::_toJPEG($img, $this->jpeg_quality);
}
}
} catch (Exception $e) {
$info = false;
}
}
if ($info === false and extension_loaded('imagick')) {
try {
// ImageMagick library
$img = new Imagick();
if ($type == 'SVG') {
// get SVG file content
$svgimg = TCPDF_STATIC::fileGetContents($file);
if ($svgimg !== FALSE) {
// get width and height
$regs = array();
if (preg_match('/<svg([^\\>]*)>/si', $svgimg, $regs)) {
$svgtag = $regs[1];
$tmp = array();
if (preg_match('/[\\s]+width[\\s]*=[\\s]*"([^"]*)"/si', $svgtag, $tmp)) {