Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Static Public Member Functions
Zend_Pdf_Resource_ImageFactory Class Reference

Static Public Member Functions

static factory ($filename)
 

Detailed Description

Definition at line 33 of file ImageFactory.php.

Member Function Documentation

◆ factory()

static factory (   $filename)
static

Definition at line 35 of file ImageFactory.php.

35  {
36  if(!is_file($filename)) {
37  #require_once 'Zend/Pdf/Exception.php';
38  throw new Zend_Pdf_Exception("Cannot create image resource. File not found.");
39  }
40  $extension = pathinfo($filename, PATHINFO_EXTENSION);
41  /*
42  * There are plans to use Zend_Mime and not file extension. In the mean time, if you need to
43  * use an alternate file extension just spin up the right processor directly.
44  */
45  switch (strtolower($extension)) {
46  case 'tif':
47  //Fall through to next case;
48  case 'tiff':
49  #require_once 'Zend/Pdf/Resource/Image/Tiff.php';
50  return new Zend_Pdf_Resource_Image_Tiff($filename);
51  break;
52  case 'png':
53  #require_once 'Zend/Pdf/Resource/Image/Png.php';
54  return new Zend_Pdf_Resource_Image_Png($filename);
55  break;
56  case 'jpg':
57  //Fall through to next case;
58  case 'jpe':
59  //Fall through to next case;
60  case 'jpeg':
61  #require_once 'Zend/Pdf/Resource/Image/Jpeg.php';
62  return new Zend_Pdf_Resource_Image_Jpeg($filename);
63  break;
64  default:
65  #require_once 'Zend/Pdf/Exception.php';
66  throw new Zend_Pdf_Exception("Cannot create image resource. File extension not known or unsupported type.");
67  break;
68  }
69  }

The documentation for this class was generated from the following file: