Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Static Public Member Functions | Data Fields | Static Protected Member Functions
Zend_Pdf_Image Class Reference

Static Public Member Functions

static imageWithPath ($filePath)
 

Data Fields

const TYPE_UNKNOWN = 0
 
const TYPE_JPEG = 1
 
const TYPE_PNG = 2
 
const TYPE_TIFF = 3
 
const TIFF_FIELD_TYPE_BYTE =1
 
const TIFF_FIELD_TYPE_ASCII =2
 
const TIFF_FIELD_TYPE_SHORT =3
 
const TIFF_FIELD_TYPE_LONG =4
 
const TIFF_FIELD_TYPE_RATIONAL =5
 
const TIFF_TAG_IMAGE_WIDTH =256
 
const TIFF_TAG_IMAGE_LENGTH =257
 
const TIFF_TAG_BITS_PER_SAMPLE =258
 
const TIFF_TAG_COMPRESSION =259
 
const TIFF_TAG_PHOTOMETRIC_INTERPRETATION =262
 
const TIFF_TAG_STRIP_OFFSETS =273
 
const TIFF_TAG_SAMPLES_PER_PIXEL =277
 
const TIFF_TAG_STRIP_BYTE_COUNTS =279
 
const TIFF_COMPRESSION_UNCOMPRESSED = 1
 
const TIFF_COMPRESSION_CCITT1D = 2
 
const TIFF_COMPRESSION_GROUP_3_FAX = 3
 
const TIFF_COMPRESSION_GROUP_4_FAX = 4
 
const TIFF_COMPRESSION_LZW = 5
 
const TIFF_COMPRESSION_JPEG = 6
 
const TIFF_COMPRESSION_FLATE = 8
 
const TIFF_COMPRESSION_FLATE_OBSOLETE_CODE = 32946
 
const TIFF_COMPRESSION_PACKBITS = 32773
 
const TIFF_PHOTOMETRIC_INTERPRETATION_WHITE_IS_ZERO =0
 
const TIFF_PHOTOMETRIC_INTERPRETATION_BLACK_IS_ZERO =1
 
const TIFF_PHOTOMETRIC_INTERPRETATION_RGB =2
 
const TIFF_PHOTOMETRIC_INTERPRETATION_RGB_INDEXED =3
 
const TIFF_PHOTOMETRIC_INTERPRETATION_CMYK =5
 
const TIFF_PHOTOMETRIC_INTERPRETATION_YCBCR =6
 
const TIFF_PHOTOMETRIC_INTERPRETATION_CIELAB =8
 
const PNG_COMPRESSION_DEFAULT_STRATEGY = 0
 
const PNG_COMPRESSION_FILTERED = 1
 
const PNG_COMPRESSION_HUFFMAN_ONLY = 2
 
const PNG_COMPRESSION_RLE = 3
 
const PNG_FILTER_NONE = 0
 
const PNG_FILTER_SUB = 1
 
const PNG_FILTER_UP = 2
 
const PNG_FILTER_AVERAGE = 3
 
const PNG_FILTER_PAETH = 4
 
const PNG_INTERLACING_DISABLED = 0
 
const PNG_INTERLACING_ENABLED = 1
 
const PNG_CHANNEL_GRAY = 0
 
const PNG_CHANNEL_RGB = 2
 
const PNG_CHANNEL_INDEXED = 3
 
const PNG_CHANNEL_GRAY_ALPHA = 4
 
const PNG_CHANNEL_RGB_ALPHA = 6
 

Static Protected Member Functions

static _extractJpegImage ($dataSource)
 
static _extractPngImage ($dataSource)
 
static _extractTiffImage ($dataSource)
 

Detailed Description

Definition at line 36 of file Image.php.

Member Function Documentation

◆ _extractJpegImage()

static _extractJpegImage (   $dataSource)
staticprotected

Attempts to extract a JPEG Image from the data source.

Parameters
Zend_Pdf_FileParserDataSource$dataSource
Returns
Zend_Pdf_Resource_Image_Jpeg May also return null if the data source does not appear to contain valid image data.
Exceptions
Zend_Pdf_Exception

Definition at line 194 of file Image.php.

195  {
196  #require_once 'Zend/Pdf/Exception.php';
197  throw new Zend_Pdf_Exception('Jpeg image fileparser is not implemented. Old styly implementation has to be used.');
198 
199  #require_once 'Zend/Pdf/FileParser/Image/Jpeg.php';
200  $imageParser = new Zend_Pdf_FileParser_Image_Jpeg($dataSource);
201  #require_once 'Zend/Pdf/Resource/Image/Jpeg.php';
202  $image = new Zend_Pdf_Resource_Image_Jpeg($imageParser);
203  unset($imageParser);
204 
205  return $image;
206  }

◆ _extractPngImage()

static _extractPngImage (   $dataSource)
staticprotected

Attempts to extract a PNG Image from the data source.

Parameters
Zend_Pdf_FileParserDataSource$dataSource
Returns
Zend_Pdf_Resource_Image_Png May also return null if the data source does not appear to contain valid image data.

Definition at line 215 of file Image.php.

216  {
217  #require_once 'Zend/Pdf/FileParser/Image/Png.php';
218  $imageParser = new Zend_Pdf_FileParser_Image_Png($dataSource);
219  #require_once 'Zend/Pdf/Resource/Image/Png.php';
220  $image = new Zend_Pdf_Resource_Image_Png($imageParser);
221  unset($imageParser);
222 
223  return $image;
224  }

◆ _extractTiffImage()

static _extractTiffImage (   $dataSource)
staticprotected

Attempts to extract a TIFF Image from the data source.

Parameters
Zend_Pdf_FileParserDataSource$dataSource
Returns
Zend_Pdf_Resource_Image_Tiff May also return null if the data source does not appear to contain valid image data.
Exceptions
Zend_Pdf_Exception

Definition at line 234 of file Image.php.

235  {
236  #require_once 'Zend/Pdf/Exception.php';
237  throw new Zend_Pdf_Exception('Tiff image fileparser is not implemented. Old styly implementation has to be used.');
238 
239  #require_once 'Zend/Pdf/FileParser/Image/Tiff.php';
240  $imageParser = new Zend_Pdf_FileParser_Image_Tiff($dataSource);
241  #require_once 'Zend/Pdf/Resource/Image/Tiff.php';
242  $image = new Zend_Pdf_Resource_Image_Tiff($imageParser);
243  unset($imageParser);
244 
245  return $image;
246  }

◆ imageWithPath()

static imageWithPath (   $filePath)
static

Returns a Zend_Pdf_Resource_Image object by file path.

Parameters
string$filePathFull path to the image file.
Returns
Zend_Pdf_Resource_Image
Exceptions
Zend_Pdf_Exception

use old implementation

Todo:
switch to new implementation

Definition at line 117 of file Image.php.

118  {
123  #require_once 'Zend/Pdf/Resource/ImageFactory.php';
124  return Zend_Pdf_Resource_ImageFactory::factory($filePath);
125 
126 
127  /* Create a file parser data source object for this file. File path and
128  * access permission checks are handled here.
129  */
130  #require_once 'Zend/Pdf/FileParserDataSource/File.php';
131  $dataSource = new Zend_Pdf_FileParserDataSource_File($filePath);
132 
133  /* Attempt to determine the type of image. We can't always trust file
134  * extensions, but try that first since it's fastest.
135  */
136  $fileExtension = strtolower(pathinfo($filePath, PATHINFO_EXTENSION));
137 
138  /* If it turns out that the file is named improperly and we guess the
139  * wrong type, we'll get null instead of an image object.
140  */
141  switch ($fileExtension) {
142  case 'tif':
143  //Fall through to next case;
144  case 'tiff':
146  break;
147  case 'png':
149  break;
150  case 'jpg':
151  //Fall through to next case;
152  case 'jpe':
153  //Fall through to next case;
154  case 'jpeg':
156  break;
157  default:
158  #require_once 'Zend/Pdf/Exception.php';
159  throw new Zend_Pdf_Exception("Cannot create image resource. File extension not known or unsupported type.");
160  break;
161  }
162 
163  /* Done with the data source object.
164  */
165  $dataSource = null;
166 
167  if ($image !== null) {
168  return $image;
169 
170  } else {
171  /* The type of image could not be determined. Give up.
172  */
173  #require_once 'Zend/Pdf/Exception.php';
174  throw new Zend_Pdf_Exception("Cannot determine image type: $filePath",
176  }
177  }
static _extractJpegImage($dataSource)
Definition: Image.php:194
static _extractTiffImage($dataSource)
Definition: Image.php:234
static _extractPngImage($dataSource)
Definition: Image.php:215
const CANT_DETERMINE_IMAGE_TYPE
Definition: Exception.php:336

Field Documentation

◆ PNG_CHANNEL_GRAY

const PNG_CHANNEL_GRAY = 0

Definition at line 99 of file Image.php.

◆ PNG_CHANNEL_GRAY_ALPHA

const PNG_CHANNEL_GRAY_ALPHA = 4

Definition at line 102 of file Image.php.

◆ PNG_CHANNEL_INDEXED

const PNG_CHANNEL_INDEXED = 3

Definition at line 101 of file Image.php.

◆ PNG_CHANNEL_RGB

const PNG_CHANNEL_RGB = 2

Definition at line 100 of file Image.php.

◆ PNG_CHANNEL_RGB_ALPHA

const PNG_CHANNEL_RGB_ALPHA = 6

Definition at line 103 of file Image.php.

◆ PNG_COMPRESSION_DEFAULT_STRATEGY

const PNG_COMPRESSION_DEFAULT_STRATEGY = 0

Definition at line 85 of file Image.php.

◆ PNG_COMPRESSION_FILTERED

const PNG_COMPRESSION_FILTERED = 1

Definition at line 86 of file Image.php.

◆ PNG_COMPRESSION_HUFFMAN_ONLY

const PNG_COMPRESSION_HUFFMAN_ONLY = 2

Definition at line 87 of file Image.php.

◆ PNG_COMPRESSION_RLE

const PNG_COMPRESSION_RLE = 3

Definition at line 88 of file Image.php.

◆ PNG_FILTER_AVERAGE

const PNG_FILTER_AVERAGE = 3

Definition at line 93 of file Image.php.

◆ PNG_FILTER_NONE

const PNG_FILTER_NONE = 0

Definition at line 90 of file Image.php.

◆ PNG_FILTER_PAETH

const PNG_FILTER_PAETH = 4

Definition at line 94 of file Image.php.

◆ PNG_FILTER_SUB

const PNG_FILTER_SUB = 1

Definition at line 91 of file Image.php.

◆ PNG_FILTER_UP

const PNG_FILTER_UP = 2

Definition at line 92 of file Image.php.

◆ PNG_INTERLACING_DISABLED

const PNG_INTERLACING_DISABLED = 0

Definition at line 96 of file Image.php.

◆ PNG_INTERLACING_ENABLED

const PNG_INTERLACING_ENABLED = 1

Definition at line 97 of file Image.php.

◆ TIFF_COMPRESSION_CCITT1D

const TIFF_COMPRESSION_CCITT1D = 2

Definition at line 66 of file Image.php.

◆ TIFF_COMPRESSION_FLATE

const TIFF_COMPRESSION_FLATE = 8

Definition at line 71 of file Image.php.

◆ TIFF_COMPRESSION_FLATE_OBSOLETE_CODE

const TIFF_COMPRESSION_FLATE_OBSOLETE_CODE = 32946

Definition at line 72 of file Image.php.

◆ TIFF_COMPRESSION_GROUP_3_FAX

const TIFF_COMPRESSION_GROUP_3_FAX = 3

Definition at line 67 of file Image.php.

◆ TIFF_COMPRESSION_GROUP_4_FAX

const TIFF_COMPRESSION_GROUP_4_FAX = 4

Definition at line 68 of file Image.php.

◆ TIFF_COMPRESSION_JPEG

const TIFF_COMPRESSION_JPEG = 6

Definition at line 70 of file Image.php.

◆ TIFF_COMPRESSION_LZW

const TIFF_COMPRESSION_LZW = 5

Definition at line 69 of file Image.php.

◆ TIFF_COMPRESSION_PACKBITS

const TIFF_COMPRESSION_PACKBITS = 32773

Definition at line 73 of file Image.php.

◆ TIFF_COMPRESSION_UNCOMPRESSED

const TIFF_COMPRESSION_UNCOMPRESSED = 1

Definition at line 65 of file Image.php.

◆ TIFF_FIELD_TYPE_ASCII

const TIFF_FIELD_TYPE_ASCII =2

Definition at line 51 of file Image.php.

◆ TIFF_FIELD_TYPE_BYTE

const TIFF_FIELD_TYPE_BYTE =1

Definition at line 50 of file Image.php.

◆ TIFF_FIELD_TYPE_LONG

const TIFF_FIELD_TYPE_LONG =4

Definition at line 53 of file Image.php.

◆ TIFF_FIELD_TYPE_RATIONAL

const TIFF_FIELD_TYPE_RATIONAL =5

Definition at line 54 of file Image.php.

◆ TIFF_FIELD_TYPE_SHORT

const TIFF_FIELD_TYPE_SHORT =3

Definition at line 52 of file Image.php.

◆ TIFF_PHOTOMETRIC_INTERPRETATION_BLACK_IS_ZERO

const TIFF_PHOTOMETRIC_INTERPRETATION_BLACK_IS_ZERO =1

Definition at line 76 of file Image.php.

◆ TIFF_PHOTOMETRIC_INTERPRETATION_CIELAB

const TIFF_PHOTOMETRIC_INTERPRETATION_CIELAB =8

Definition at line 81 of file Image.php.

◆ TIFF_PHOTOMETRIC_INTERPRETATION_CMYK

const TIFF_PHOTOMETRIC_INTERPRETATION_CMYK =5

Definition at line 79 of file Image.php.

◆ TIFF_PHOTOMETRIC_INTERPRETATION_RGB

const TIFF_PHOTOMETRIC_INTERPRETATION_RGB =2

Definition at line 77 of file Image.php.

◆ TIFF_PHOTOMETRIC_INTERPRETATION_RGB_INDEXED

const TIFF_PHOTOMETRIC_INTERPRETATION_RGB_INDEXED =3

Definition at line 78 of file Image.php.

◆ TIFF_PHOTOMETRIC_INTERPRETATION_WHITE_IS_ZERO

const TIFF_PHOTOMETRIC_INTERPRETATION_WHITE_IS_ZERO =0

Definition at line 75 of file Image.php.

◆ TIFF_PHOTOMETRIC_INTERPRETATION_YCBCR

const TIFF_PHOTOMETRIC_INTERPRETATION_YCBCR =6

Definition at line 80 of file Image.php.

◆ TIFF_TAG_BITS_PER_SAMPLE

const TIFF_TAG_BITS_PER_SAMPLE =258

Definition at line 58 of file Image.php.

◆ TIFF_TAG_COMPRESSION

const TIFF_TAG_COMPRESSION =259

Definition at line 59 of file Image.php.

◆ TIFF_TAG_IMAGE_LENGTH

const TIFF_TAG_IMAGE_LENGTH =257

Definition at line 57 of file Image.php.

◆ TIFF_TAG_IMAGE_WIDTH

const TIFF_TAG_IMAGE_WIDTH =256

Definition at line 56 of file Image.php.

◆ TIFF_TAG_PHOTOMETRIC_INTERPRETATION

const TIFF_TAG_PHOTOMETRIC_INTERPRETATION =262

Definition at line 60 of file Image.php.

◆ TIFF_TAG_SAMPLES_PER_PIXEL

const TIFF_TAG_SAMPLES_PER_PIXEL =277

Definition at line 62 of file Image.php.

◆ TIFF_TAG_STRIP_BYTE_COUNTS

const TIFF_TAG_STRIP_BYTE_COUNTS =279

Definition at line 63 of file Image.php.

◆ TIFF_TAG_STRIP_OFFSETS

const TIFF_TAG_STRIP_OFFSETS =273

Definition at line 61 of file Image.php.

◆ TYPE_JPEG

const TYPE_JPEG = 1

Definition at line 44 of file Image.php.

◆ TYPE_PNG

const TYPE_PNG = 2

Definition at line 45 of file Image.php.

◆ TYPE_TIFF

const TYPE_TIFF = 3

Definition at line 46 of file Image.php.

◆ TYPE_UNKNOWN

const TYPE_UNKNOWN = 0

Definition at line 43 of file Image.php.


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