本文整理汇总了PHP中Cpdf::addPngFromFile方法的典型用法代码示例。如果您正苦于以下问题:PHP Cpdf::addPngFromFile方法的具体用法?PHP Cpdf::addPngFromFile怎么用?PHP Cpdf::addPngFromFile使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Cpdf
的用法示例。
在下文中一共展示了Cpdf::addPngFromFile方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: image
function image($img, $x, $y, $w, $h, $resolution = "normal")
{
list($width, $height, $type) = dompdf_getimagesize($img);
$debug_png = $this->_dompdf->get_option("debug_png");
if ($debug_png) {
print "[image:{$img}|{$width}|{$height}|{$type}]";
}
switch ($type) {
case IMAGETYPE_JPEG:
if ($debug_png) {
print '!!!jpg!!!';
}
$this->_pdf->addJpegFromFile($img, $x, $this->y($y) - $h, $w, $h);
break;
case IMAGETYPE_GIF:
case IMAGETYPE_BMP:
if ($debug_png) {
print '!!!bmp or gif!!!';
}
// @todo use cache for BMP and GIF
$img = $this->_convert_gif_bmp_to_png($img, $type);
case IMAGETYPE_PNG:
if ($debug_png) {
print '!!!png!!!';
}
$this->_pdf->addPngFromFile($img, $x, $this->y($y) - $h, $w, $h);
break;
default:
if ($debug_png) {
print '!!!unknown!!!';
}
}
}
示例2: image
function image($img_url, $img_type, $x, $y, $w, $h)
{
switch ($img_type) {
case "jpeg":
case "jpg":
$this->_pdf->addJpegFromFile($img_url, $x, $this->y($y) - $h, $w, $h);
break;
case "png":
$this->_pdf->addPngFromFile($img_url, $x, $this->y($y) - $h, $w, $h);
break;
default:
break;
}
return;
}
示例3: image
function image($img, $x, $y, $w, $h, $resolution = "normal")
{
list($width, $height, $type) = $this->getimagesize($img);
switch ($type) {
case IMAGETYPE_JPEG:
$this->canvas->addJpegFromFile($img, $x, $y - $h, $w, $h);
break;
case IMAGETYPE_GIF:
case IMAGETYPE_BMP:
// @todo use cache for BMP and GIF
$img = $this->_convert_gif_bmp_to_png($img, $type);
case IMAGETYPE_PNG:
$this->canvas->addPngFromFile($img, $x, $y - $h, $w, $h);
break;
default:
}
}
示例4: image
function image($img_url, $img_type, $x, $y, $w, $h)
{
$img_type = mb_strtolower($img_type);
switch ($img_type) {
case "jpeg":
case "jpg":
$this->_pdf->addJpegFromFile($img_url, $x, $this->y($y) - $h, $w, $h);
break;
case "png":
$this->_pdf->addPngFromFile($img_url, $x, $this->y($y) - $h, $w, $h);
break;
case "gif":
// Convert gifs to pngs
$img_url = $this->_convert_gif_to_png($img_url);
$this->_pdf->addPngFromFile($img_url, $x, $this->y($y) - $h, $w, $h);
break;
default:
break;
}
return;
}
示例5: image
function image($img, $x, $y, $w, $h, $resolution = "normal")
{
list($width, $height, $type) = Helpers::dompdf_getimagesize($img, $this->get_dompdf()->getHttpContext());
$debug_png = $this->_dompdf->getOptions()->getDebugPng();
if ($debug_png) {
print "[image:{$img}|{$width}|{$height}|{$type}]";
}
switch ($type) {
case "jpeg":
if ($debug_png) {
print '!!!jpg!!!';
}
$this->_pdf->addJpegFromFile($img, $x, $this->y($y) - $h, $w, $h);
break;
case "gif":
case "bmp":
if ($debug_png) {
print '!!!bmp or gif!!!';
}
// @todo use cache for BMP and GIF
$img = $this->_convert_gif_bmp_to_png($img, $type);
case "png":
if ($debug_png) {
print '!!!png!!!';
}
$this->_pdf->addPngFromFile($img, $x, $this->y($y) - $h, $w, $h);
break;
case "svg":
if ($debug_png) {
print '!!!SVG!!!';
}
$this->_pdf->addSvgFromFile($img, $x, $this->y($y) - $h, $w, $h);
break;
default:
if ($debug_png) {
print '!!!unknown!!!';
}
}
}
示例6: image
function image($img_url, $img_type, $x, $y, $w, $h)
{
//debugpng
if (DEBUGPNG) {
print '[image:' . $img_url . '|' . $img_type . ']';
}
$img_type = mb_strtolower($img_type);
switch ($img_type) {
case "jpeg":
case "jpg":
//debugpng
if (DEBUGPNG) {
print '!!!jpg!!!';
}
$this->_pdf->addJpegFromFile($img_url, $x, $this->y($y) - $h, $w, $h);
break;
case "png":
//debugpng
if (DEBUGPNG) {
print '!!!png!!!';
}
$this->_pdf->addPngFromFile($img_url, $x, $this->y($y) - $h, $w, $h);
break;
case "gif":
// Convert gifs to pngs
//DEBUG_IMG_TEMP
//if (0) {
if (method_exists($this->_pdf, "addImagePng")) {
//debugpng
if (DEBUGPNG) {
print '!!!gif addImagePng!!!';
}
//If optimization to direct png creation from gd object is available,
//don't create temp file, but place gd object directly into the pdf
if (method_exists($this->_pdf, "image_iscached") && $this->_pdf->image_iscached($img_url)) {
//If same image has occured already before, no need to load because
//duplicate will anyway be eliminated.
$img = null;
} else {
$img = @imagecreatefromgif($img_url);
if (!$img) {
return;
}
imageinterlace($img, 0);
}
$this->_pdf->addImagePng($img_url, $x, $this->y($y) - $h, $w, $h, $img);
} else {
//debugpng
if (DEBUGPNG) {
print '!!!gif addPngFromFile!!!';
}
$img_url = $this->_convert_gif_to_png($img_url);
$this->_pdf->addPngFromFile($img_url, $x, $this->y($y) - $h, $w, $h);
}
break;
default:
//debugpng
if (DEBUGPNG) {
print '!!!unknown!!!';
}
break;
}
return;
}
示例7: image
function image($img, $x, $y, $w, $h, $resolution = "normal")
{
list($width, $height, $type) = dompdf_getimagesize($img);
//debugpng
if (DEBUGPNG) print "[image:$img|$width|$height|$type]";
switch ($type) {
case IMAGETYPE_JPEG:
if (DEBUGPNG) print '!!!jpg!!!';
$this->_pdf->addJpegFromFile($img, $x, $this->y($y) - $h, $w, $h);
break;
case IMAGETYPE_GIF:
case IMAGETYPE_BMP:
if (DEBUGPNG) print '!!!bmp or gif!!!';
// @todo use cache for BMP and GIF
$img = $this->_convert_gif_bmp_to_png($img, $type);
case IMAGETYPE_PNG:
if (DEBUGPNG) print '!!!png!!!';
$this->_pdf->addPngFromFile($img, $x, $this->y($y) - $h, $w, $h);
break;
default:
if (DEBUGPNG) print '!!!unknown!!!';
}
}