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


PHP TCPDF_STATIC::fileGetContents方法代码示例

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


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

示例1: ImageSVG

 /**
  * Embedd a Scalable Vector Graphics (SVG) image.
  * NOTE: SVG standard is not yet fully implemented, use the setRasterizeVectorImages() method to enable/disable rasterization of vector images using ImageMagick library.
  * @param $file (string) Name of the SVG file or a '@' character followed by the SVG data string.
  * @param $x (float) Abscissa of the upper-left corner.
  * @param $y (float) Ordinate of the upper-left corner.
  * @param $w (float) Width of the image in the page. If not specified or equal to zero, it is automatically calculated.
  * @param $h (float) Height of the image in the page. If not specified or equal to zero, it is automatically calculated.
  * @param $link (mixed) URL or identifier returned by AddLink().
  * @param $align (string) Indicates the alignment of the pointer next to image insertion relative to image height. The value can be:<ul><li>T: top-right for LTR or top-left for RTL</li><li>M: middle-right for LTR or middle-left for RTL</li><li>B: bottom-right for LTR or bottom-left for RTL</li><li>N: next line</li></ul> If the alignment is an empty string, then the pointer will be restored on the starting SVG position.
  * @param $palign (string) Allows to center or align the image on the current line. Possible values are:<ul><li>L : left align</li><li>C : center</li><li>R : right align</li><li>'' : empty string : left for LTR or right for RTL</li></ul>
  * @param $border (mixed) Indicates if borders must be drawn around the cell. The value can be a number:<ul><li>0: no border (default)</li><li>1: frame</li></ul> or a string containing some or all of the following characters (in any order):<ul><li>L: left</li><li>T: top</li><li>R: right</li><li>B: bottom</li></ul> or an array of line styles for each border group - for example: array('LTRB' => array('width' => 2, 'cap' => 'butt', 'join' => 'miter', 'dash' => 0, 'color' => array(0, 0, 0)))
  * @param $fitonpage (boolean) if true the image is resized to not exceed page dimensions.
  * @author Nicola Asuni
  * @since 5.0.000 (2010-05-02)
  * @public
  */
 public function ImageSVG($file, $x = '', $y = '', $w = 0, $h = 0, $link = '', $align = '', $palign = '', $border = 0, $fitonpage = false)
 {
     if ($this->state != 2) {
         return;
     }
     if ($this->rasterize_vector_images and $w > 0 and $h > 0) {
         // convert SVG to raster image using GD or ImageMagick libraries
         return $this->Image($file, $x, $y, $w, $h, 'SVG', $link, $align, true, 300, $palign, false, false, $border, false, false, false);
     }
     if ($file[0] === '@') {
         // image from string
         $this->svgdir = '';
         $svgdata = substr($file, 1);
     } else {
         // SVG file
         $this->svgdir = dirname($file);
         $svgdata = TCPDF_STATIC::fileGetContents($file);
     }
     if ($svgdata === FALSE) {
         $this->Error('SVG file not found: ' . $file);
     }
     if ($x === '') {
         $x = $this->x;
     }
     if ($y === '') {
         $y = $this->y;
     }
     // check page for no-write regions and adapt page margins if necessary
     list($x, $y) = $this->checkPageRegions($h, $x, $y);
     $k = $this->k;
     $ox = 0;
     $oy = 0;
     $ow = $w;
     $oh = $h;
     $aspect_ratio_align = 'xMidYMid';
     $aspect_ratio_ms = 'meet';
     $regs = array();
     // get original image width and height
     preg_match('/<svg([^\\>]*)>/si', $svgdata, $regs);
     if (isset($regs[1]) and !empty($regs[1])) {
         $tmp = array();
         if (preg_match('/[\\s]+x[\\s]*=[\\s]*"([^"]*)"/si', $regs[1], $tmp)) {
             $ox = $this->getHTMLUnitToUnits($tmp[1], 0, $this->svgunit, false);
         }
         $tmp = array();
         if (preg_match('/[\\s]+y[\\s]*=[\\s]*"([^"]*)"/si', $regs[1], $tmp)) {
             $oy = $this->getHTMLUnitToUnits($tmp[1], 0, $this->svgunit, false);
         }
         $tmp = array();
         if (preg_match('/[\\s]+width[\\s]*=[\\s]*"([^"]*)"/si', $regs[1], $tmp)) {
             $ow = $this->getHTMLUnitToUnits($tmp[1], 1, $this->svgunit, false);
         }
         $tmp = array();
         if (preg_match('/[\\s]+height[\\s]*=[\\s]*"([^"]*)"/si', $regs[1], $tmp)) {
             $oh = $this->getHTMLUnitToUnits($tmp[1], 1, $this->svgunit, false);
         }
         $tmp = array();
         $view_box = array();
         if (preg_match('/[\\s]+viewBox[\\s]*=[\\s]*"[\\s]*([0-9\\.\\-]+)[\\s]+([0-9\\.\\-]+)[\\s]+([0-9\\.]+)[\\s]+([0-9\\.]+)[\\s]*"/si', $regs[1], $tmp)) {
             if (count($tmp) == 5) {
                 array_shift($tmp);
                 foreach ($tmp as $key => $val) {
                     $view_box[$key] = $this->getHTMLUnitToUnits($val, 0, $this->svgunit, false);
                 }
                 $ox = $view_box[0];
                 $oy = $view_box[1];
             }
             // get aspect ratio
             $tmp = array();
             if (preg_match('/[\\s]+preserveAspectRatio[\\s]*=[\\s]*"([^"]*)"/si', $regs[1], $tmp)) {
                 $aspect_ratio = preg_split('/[\\s]+/si', $tmp[1]);
                 switch (count($aspect_ratio)) {
                     case 3:
                         $aspect_ratio_align = $aspect_ratio[1];
                         $aspect_ratio_ms = $aspect_ratio[2];
                         break;
                     case 2:
                         $aspect_ratio_align = $aspect_ratio[0];
                         $aspect_ratio_ms = $aspect_ratio[1];
                         break;
                     case 1:
                         $aspect_ratio_align = $aspect_ratio[0];
                         $aspect_ratio_ms = 'meet';
//.........这里部分代码省略.........
开发者ID:TheTypoMaster,项目名称:myapps,代码行数:101,代码来源:tcpdf.php


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