当前位置: 首页>>代码示例>>PHP>>正文


PHP TCPDF_IMAGES::getImageFileType方法代码示例

本文整理汇总了PHP中TCPDF_IMAGES::getImageFileType方法的典型用法代码示例。如果您正苦于以下问题:PHP TCPDF_IMAGES::getImageFileType方法的具体用法?PHP TCPDF_IMAGES::getImageFileType怎么用?PHP TCPDF_IMAGES::getImageFileType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TCPDF_IMAGES的用法示例。


在下文中一共展示了TCPDF_IMAGES::getImageFileType方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: startSVGElementHandler


//.........这里部分代码省略.........
             $h = isset($attribs['height']) ? $this->getHTMLUnitToUnits($attribs['height'], 0, $this->svgunit, false) : 0;
             $img = $attribs['xlink:href'];
             if (!$clipping) {
                 $this->StartTransform();
                 $this->SVGTransform($tm);
                 $obstyle = $this->setSVGStyles($svgstyle, $prev_svgstyle, $x, $y, $w, $h);
                 if (preg_match('/^data:image\\/[^;]+;base64,/', $img, $m) > 0) {
                     // embedded image encoded as base64
                     $img = '@' . base64_decode(substr($img, strlen($m[0])));
                 } else {
                     // fix image path
                     if (!TCPDF_STATIC::empty_string($this->svgdir) and ($img[0] == '.' or basename($img) == $img)) {
                         // replace relative path with full server path
                         $img = $this->svgdir . '/' . $img;
                     }
                     if ($img[0] == '/' and !empty($_SERVER['DOCUMENT_ROOT']) and $_SERVER['DOCUMENT_ROOT'] != '/') {
                         $findroot = strpos($img, $_SERVER['DOCUMENT_ROOT']);
                         if ($findroot === false or $findroot > 1) {
                             if (substr($_SERVER['DOCUMENT_ROOT'], -1) == '/') {
                                 $img = substr($_SERVER['DOCUMENT_ROOT'], 0, -1) . $img;
                             } else {
                                 $img = $_SERVER['DOCUMENT_ROOT'] . $img;
                             }
                         }
                     }
                     $img = urldecode($img);
                     $testscrtype = @parse_url($img);
                     if (!isset($testscrtype['query']) or empty($testscrtype['query'])) {
                         // convert URL to server path
                         $img = str_replace(K_PATH_URL, K_PATH_MAIN, $img);
                     }
                 }
                 // get image type
                 $imgtype = TCPDF_IMAGES::getImageFileType($img);
                 if ($imgtype == 'eps' or $imgtype == 'ai') {
                     $this->ImageEps($img, $x, $y, $w, $h);
                 } elseif ($imgtype == 'svg') {
                     $this->ImageSVG($img, $x, $y, $w, $h);
                 } else {
                     $this->Image($img, $x, $y, $w, $h);
                 }
                 $this->StopTransform();
             }
             break;
             // text
         // text
         case 'text':
         case 'tspan':
             // only basic support - advanced features must be implemented
             $this->svgtextmode['invisible'] = $invisible;
             if ($invisible) {
                 break;
             }
             array_push($this->svgstyles, $svgstyle);
             if (isset($attribs['x'])) {
                 $x = $this->getHTMLUnitToUnits($attribs['x'], 0, $this->svgunit, false);
             } elseif ($name == 'tspan') {
                 $x = $this->x;
             } else {
                 $x = 0;
             }
             if (isset($attribs['dx'])) {
                 $x += $this->getHTMLUnitToUnits($attribs['dx'], 0, $this->svgunit, false);
             }
             if (isset($attribs['y'])) {
                 $y = $this->getHTMLUnitToUnits($attribs['y'], 0, $this->svgunit, false);
开发者ID:TheTypoMaster,项目名称:myapps,代码行数:67,代码来源:tcpdf.php

示例2: Header

 public function Header()
 {
     if ($this->vendor->vendor_letter_header != 1) {
         return;
     }
     if ($this->header_xobjid === false) {
         // start a new XObject Template
         $this->header_xobjid = $this->startTemplate($this->w, $this->tMargin);
         $headerfont = $this->getHeaderFont();
         $headerdata = $this->getHeaderData();
         $this->y = $this->header_margin;
         $headertxt = '<style>' . $this->css . '</style>';
         $headertxt .= '<div id="vmdoc-header" class="vmdoc-header">' . $this->replace_variables($headerdata['string']) . '</div>';
         $currentCHRF = $this->getCellHeightRatio();
         $this->setCellHeightRatio($this->vendor->vendor_letter_header_cell_height_ratio);
         if ($this->rtl) {
             $this->x = $this->w - $this->original_rMargin;
         } else {
             $this->x = $this->original_lMargin;
         }
         $header_x = $this->getRTL() ? $this->original_rMargin : $this->original_lMargin;
         $cw = $this->w - $this->original_lMargin - $this->original_rMargin;
         if ($headerdata['logo'] and $headerdata['logo'] != K_BLANK_IMAGE) {
             if (!class_exists('JFile')) {
                 require VMPATH_LIBS . DS . 'joomla' . DS . 'filesystem' . DS . 'file.php';
             }
             $this->tcpdf6 = JFile::exists(VMPATH_LIBS . DS . 'tcpdf' . DS . 'include' . DS . 'tcpdf_images.php');
             if ($this->tcpdf6) {
                 if (!class_exists('TCPDF_IMAGES')) {
                     require VMPATH_LIBS . DS . 'tcpdf' . DS . 'include' . DS . 'tcpdf_images.php';
                 }
                 $imgtype = TCPDF_IMAGES::getImageFileType(VMPATH_ROOT . DS . $headerdata['logo']);
             } else {
                 $imgtype = $this->getImageFileType(VMPATH_ROOT . DS . $headerdata['logo']);
             }
             if ($imgtype == 'eps' or $imgtype == 'ai') {
                 $this->ImageEps(VMPATH_ROOT . DS . $headerdata['logo'], '', '', $headerdata['logo_width']);
             } elseif ($imgtype == 'svg') {
                 $this->ImageSVG(VMPATH_ROOT . DS . $headerdata['logo'], '', '', $headerdata['logo_width']);
             } else {
                 $this->Image(VMPATH_ROOT . DS . $headerdata['logo'], '', '', $headerdata['logo_width']);
             }
             $imgy = $this->getImageRBY();
             $header_x += $headerdata['logo_width'] * 1.1;
             $cw -= $headerdata['logo_width'] * 1.1;
         } else {
             $imgy = $this->y;
         }
         // set starting margin for text data cell
         $this->SetTextColorArray($this->header_text_color);
         // header string
         $this->SetFont($headerfont[0], $headerfont[1], $headerfont[2]);
         $this->SetX($header_x);
         $this->writeHTMLCell($cw, 0, $this->x, $this->header_margin, $headertxt, '', 2, false, true, '', true);
         // print an ending header line
         if ($this->vendor->vendor_letter_header_line == 1) {
             $this->SetLineStyle(array('width' => 0.85 / $this->k, 'cap' => 'butt', 'join' => 'miter', 'dash' => 0, 'color' => $headerdata['line_color']));
             $this->SetY(max($imgy, $this->y));
             if ($this->rtl) {
                 $this->SetX($this->original_rMargin);
             } else {
                 $this->SetX($this->original_lMargin);
             }
             $this->Cell($this->w - $this->original_lMargin - $this->original_rMargin, 0, '', 'T', 0, 'C');
         }
         $this->setCellHeightRatio($currentCHRF);
         $this->endTemplate();
     }
     // print header template
     $x = 0;
     $dx = 0;
     if (!$this->header_xobj_autoreset and $this->booklet and $this->page % 2 == 0) {
         // adjust margins for booklet mode
         $dx = $this->original_lMargin - $this->original_rMargin;
     }
     if ($this->rtl) {
         $x = $this->w + $dx;
     } else {
         $x = 0 + $dx;
     }
     $this->printTemplate($this->header_xobjid, $x, 0, 0, 0, '', '', false);
     if ($this->header_xobj_autoreset) {
         // reset header xobject template at each page
         $this->header_xobjid = false;
     }
 }
开发者ID:cybershocik,项目名称:Darek,代码行数:86,代码来源:vmpdf.php

示例3: setImage

 private function setImage($headerdata)
 {
     $imgtype = TCPDF_IMAGES::getImageFileType(K_PATH_IMAGES . $headerdata['logo']);
     if ($imgtype === 'eps' or $imgtype === 'ai') {
         $this->ImageEps(K_PATH_IMAGES . $headerdata['logo'], '', '', $headerdata['logo_width']);
     } elseif ($imgtype === 'svg') {
         $this->ImageSVG(K_PATH_IMAGES . $headerdata['logo'], '', '', $headerdata['logo_width']);
     } else {
         $this->Image(K_PATH_IMAGES . $headerdata['logo'], '', '', $headerdata['logo_width']);
     }
 }
开发者ID:josephzhao,项目名称:map2ucore,代码行数:11,代码来源:Map2uPDF.php

示例4: startSVGElementHandler


//.........这里部分代码省略.........
				$h = (isset($attribs['height'])?$this->getHTMLUnitToUnits($attribs['height'], 0, $this->svgunit, false):0);
				$img = $attribs['xlink:href'];
				if (!$clipping) {
					$this->StartTransform();
					$this->SVGTransform($tm);
					$obstyle = $this->setSVGStyles($svgstyle, $prev_svgstyle, $x, $y, $w, $h);
					if (preg_match('/^data:image\/[^;]+;base64,/', $img, $m) > 0) {
						// embedded image encoded as base64
						$img = '@'.base64_decode(substr($img, strlen($m[0])));
					} else {
						// fix image path
						if (!TCPDF_STATIC::empty_string($this->svgdir) AND (($img[0] == '.') OR (basename($img) == $img))) {
							// replace relative path with full server path
							$img = $this->svgdir.'/'.$img;
						}
						if (($img[0] == '/') AND !empty($_SERVER['DOCUMENT_ROOT']) AND ($_SERVER['DOCUMENT_ROOT'] != '/')) {
							$findroot = strpos($img, $_SERVER['DOCUMENT_ROOT']);
							if (($findroot === false) OR ($findroot > 1)) {
								if (substr($_SERVER['DOCUMENT_ROOT'], -1) == '/') {
									$img = substr($_SERVER['DOCUMENT_ROOT'], 0, -1).$img;
								} else {
									$img = $_SERVER['DOCUMENT_ROOT'].$img;
								}
							}
						}
						$img = urldecode($img);
						$testscrtype = @parse_url($img);
						if (!isset($testscrtype['query']) OR empty($testscrtype['query'])) {
							// convert URL to server path
							$img = str_replace(K_PATH_URL, K_PATH_MAIN, $img);
						}
					}
					// get image type
					$imgtype = TCPDF_IMAGES::getImageFileType($img);
					if (($imgtype == 'eps') OR ($imgtype == 'ai')) {
						$this->ImageEps($img, $x, $y, $w, $h);
					} elseif ($imgtype == 'svg') {
						// store SVG vars
						$svggradients = $this->svggradients;
						$svggradientid = $this->svggradientid;
						$svgdefsmode = $this->svgdefsmode;
						$svgdefs = $this->svgdefs;
						$svgclipmode = $this->svgclipmode;
						$svgclippaths = $this->svgclippaths;
						$svgcliptm = $this->svgcliptm;
						$svgclipid = $this->svgclipid;
						$svgtext = $this->svgtext;
						$svgtextmode = $this->svgtextmode;
						$this->ImageSVG($img, $x, $y, $w, $h);
						// restore SVG vars
						$this->svggradients = $svggradients;
						$this->svggradientid = $svggradientid;
						$this->svgdefsmode = $svgdefsmode;
						$this->svgdefs = $svgdefs;
						$this->svgclipmode = $svgclipmode;
						$this->svgclippaths = $svgclippaths;
						$this->svgcliptm = $svgcliptm;
						$this->svgclipid = $svgclipid;
						$this->svgtext = $svgtext;
						$this->svgtextmode = $svgtextmode;
					} else {
						$this->Image($img, $x, $y, $w, $h);
					}
					$this->StopTransform();
				}
				break;
开发者ID:ketanbgm,项目名称:Billing--application-codeigniter-mysql-ajax,代码行数:67,代码来源:tcpdf.php

示例5: Header

 /**
  * This method is used to render the page header and overrides the original Header() method on TCPDF.
  * @public
  */
 public function Header()
 {
     if ($this->header_xobjid === false) {
         // start a new XObject Template
         $this->header_xobjid = $this->startTemplate($this->w, $this->tMargin);
         $headerfont = $this->getHeaderFont();
         $headerdata = $this->getHeaderData();
         $this->y = $this->header_margin;
         if ($this->rtl) {
             $this->x = $this->w - $this->original_rMargin;
         } else {
             $this->x = $this->original_lMargin;
         }
         if ($headerdata['logo'] and $headerdata['logo'] != K_BLANK_IMAGE) {
             $imgtype = TCPDF_IMAGES::getImageFileType(K_PATH_IMAGES . $headerdata['logo']);
             if ($imgtype == 'eps' or $imgtype == 'ai') {
                 $this->ImageEps(K_PATH_IMAGES . $headerdata['logo'], '', '', $headerdata['logo_width']);
             } elseif ($imgtype == 'svg') {
                 $this->ImageSVG(K_PATH_IMAGES . $headerdata['logo'], '', '', $headerdata['logo_width']);
             } else {
                 $this->Image(K_PATH_IMAGES . $headerdata['logo'], '', '', $headerdata['logo_width']);
             }
             $imgy = $this->getImageRBY();
         } else {
             $imgy = $this->y;
         }
         $cell_height = round($this->cell_height_ratio * $headerfont[2] / $this->k, 2);
         // set starting margin for text data cell
         if ($this->getRTL()) {
             $header_x = $this->original_rMargin + $headerdata['logo_width'] * 1.1;
         } else {
             $header_x = $this->original_lMargin + $headerdata['logo_width'] * 1.1;
         }
         $cw = $this->w - $this->original_lMargin - $this->original_rMargin - $headerdata['logo_width'] * 1.1;
         $this->SetTextColor(0, 0, 0);
         // header title
         $this->SetFont($headerfont[0], 'B', $headerfont[2] + 1);
         $this->SetX($header_x);
         $this->Cell($cw, $cell_height, $headerdata['title'], 0, 1, '', 0, '', 0);
         // header string
         $this->SetFont($headerfont[0], $headerfont[1], $headerfont[2]);
         $this->SetX($header_x);
         $this->MultiCell($cw, $cell_height, $headerdata['string'], 0, '', 0, 1, '', '', true, 0, false);
         // print an ending header line
         $this->SetLineStyle(array('width' => 0.85 / $this->k, 'cap' => 'butt', 'join' => 'miter', 'dash' => 0, 'color' => array(0, 0, 0)));
         if (!empty($this->tcexam_backlink)) {
             // set style for barcode
             $style = array('border' => false, 'vpadding' => 0, 'hpadding' => 0, 'fgcolor' => array(0, 0, 0), 'bgcolor' => false, 'module_width' => 1, 'module_height' => 1);
             // QRCODE
             $w = PDF_MARGIN_TOP - PDF_MARGIN_HEADER - 5.7 / $this->k;
             $y = PDF_MARGIN_HEADER;
             if ($this->rtl) {
                 $x = PDF_MARGIN_LEFT + $w;
             } else {
                 $x = $this->w - PDF_MARGIN_RIGHT - $w;
             }
             // write QR-Code on header
             $this->write2DBarcode($this->tcexam_backlink, 'QRCODE,L', $x, $y, $w, $w, $style, 'N');
         }
         $this->SetY(2.835 / $this->k + max($imgy, $this->y));
         if ($this->rtl) {
             $this->SetX($this->original_rMargin);
         } else {
             $this->SetX($this->original_lMargin);
         }
         $this->Cell($this->w - $this->original_lMargin - $this->original_rMargin, 0, '', 'T', 0, 'C');
         $this->endTemplate();
     }
     // print header template
     $x = 0;
     $dx = 0;
     if ($this->booklet and $this->page % 2 == 0) {
         // adjust margins for booklet mode
         $dx = $this->original_lMargin - $this->original_rMargin;
     }
     if ($this->rtl) {
         $x = $this->w + $dx;
     } else {
         $x = 0 + $dx;
     }
     $this->printTemplate($this->header_xobjid, $x, 0, 0, 0, '', '', false);
 }
开发者ID:dungvu,项目名称:tcexam,代码行数:86,代码来源:tcpdfex.php


注:本文中的TCPDF_IMAGES::getImageFileType方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。