Parser
in package
Pdf image parser class
Tags
Table of Contents
Properties
- $alpha : bool
- Flag for if the image has an alpha channel
- $basename : string|null
- Image basename
- $channels : int|null
- Number of channels in the image
- $colorMode : mixed
- Image color mode
- $colorTotal : int
- Image total number of colors
- $convertedImage : string|null
- Converted GIF to PNG image
- $depth : int
- Image bit-depth
- $extension : string|null
- Image extension
- $filename : string|null
- Image filename
- $fullpath : string|null
- Image fullpath
- $height : int
- Image height
- $imageData : mixed
- Image data
- $imageDataLength : int|null
- Image data length
- $index : int|null
- Image object index
- $mime : string|null
- Image mime
- $objects : array<string|int, mixed>
- Image objects
- $resize : array<string|int, mixed>|null
- Image resize value
- $resizedImage : string|null
- Resized image
- $resource : mixed
- GD image resource
- $stream : string|null
- Image stream
- $width : int
- Image width
- $x : int
- Image X Coordinate
- $y : int
- Image Y Coordinate
Methods
- __construct() : mixed
- Constructor
- convertToJpeg() : void
- Method to convert the image to Jpg
- createImageFromFile() : Parser
- Create image from file
- createImageFromStream() : Parser
- Create image from stream
- getConvertedImage() : string|null
- Get the converted image
- getHeight() : int
- Get the height
- getIndex() : int|null
- Get the image object index
- getObjects() : array<string|int, mixed>
- Get the image objects
- getStream() : string
- Get the image stream
- getWidth() : int
- Get the width
- getX() : int
- Get the X coordinate
- getXObject() : string
- Get the XObject
- getY() : int
- Get the Y coordinate
- loadImageFromFile() : Parser
- Load image from file
- loadImageFromStream() : Parser
- Load image from stream
- parse() : void
- Parse the image data and create the image objects
- setIndex() : Parser
- Set the image object index
- setX() : Parser
- Set the X coordinate
- setY() : Parser
- Set the Y coordinate
- convertImage() : void
- Method to convert the image from GIF to PNG.
- createResource() : void
- Create a new image resource based on the current image type of the image object.
- parseImageData() : void
- Parse image data
- parseJpeg() : void
- Parse the JPG image data
- parsePng() : void
- Parse the PNG image data
- readInt() : int
- Method to read an unsigned integer.
- resizeImage() : void
- Method to resize the image.
Properties
$alpha
Flag for if the image has an alpha channel
protected
bool
$alpha
= false
$basename
Image basename
protected
string|null
$basename
= null
$channels
Number of channels in the image
protected
int|null
$channels
= null
$colorMode
Image color mode
protected
mixed
$colorMode
= null
$colorTotal
Image total number of colors
protected
int
$colorTotal
= 0
$convertedImage
Converted GIF to PNG image
protected
string|null
$convertedImage
= null
$depth
Image bit-depth
protected
int
$depth
= 0
$extension
Image extension
protected
string|null
$extension
= null
$filename
Image filename
protected
string|null
$filename
= null
$fullpath
Image fullpath
protected
string|null
$fullpath
= null
$height
Image height
protected
int
$height
= 0
$imageData
Image data
protected
mixed
$imageData
= null
$imageDataLength
Image data length
protected
int|null
$imageDataLength
= null
$index
Image object index
protected
int|null
$index
= null
$mime
Image mime
protected
string|null
$mime
= null
$objects
Image objects
protected
array<string|int, mixed>
$objects
= []
$resize
Image resize value
protected
array<string|int, mixed>|null
$resize
= null
$resizedImage
Resized image
protected
string|null
$resizedImage
= null
$resource
GD image resource
protected
mixed
$resource
= null
$stream
Image stream
protected
string|null
$stream
= null
$width
Image width
protected
int
$width
= 0
$x
Image X Coordinate
protected
int
$x
= 0
$y
Image Y Coordinate
protected
int
$y
= 0
Methods
__construct()
Constructor
public
__construct(int $x, int $y) : mixed
Instantiate a image parser object
Parameters
- $x : int
- $y : int
convertToJpeg()
Method to convert the image to Jpg
public
convertToJpeg([int $quality = 70 ]) : void
Parameters
- $quality : int = 70
createImageFromFile()
Create image from file
public
static createImageFromFile(string $imageFile, int $x, int $y[, array<string|int, mixed>|null $resize = null ][, bool $preserveResolution = false ]) : Parser
Parameters
- $imageFile : string
- $x : int
- $y : int
- $resize : array<string|int, mixed>|null = null
- $preserveResolution : bool = false
Return values
ParsercreateImageFromStream()
Create image from stream
public
static createImageFromStream(string $imageStream, int $x, int $y[, array<string|int, mixed>|null $resize = null ][, bool $preserveResolution = false ]) : Parser
Parameters
- $imageStream : string
- $x : int
- $y : int
- $resize : array<string|int, mixed>|null = null
- $preserveResolution : bool = false
Return values
ParsergetConvertedImage()
Get the converted image
public
getConvertedImage() : string|null
Return values
string|nullgetHeight()
Get the height
public
getHeight() : int
Return values
intgetIndex()
Get the image object index
public
getIndex() : int|null
Return values
int|nullgetObjects()
Get the image objects
public
getObjects() : array<string|int, mixed>
Tags
Return values
array<string|int, mixed>getStream()
Get the image stream
public
getStream() : string
Return values
stringgetWidth()
Get the width
public
getWidth() : int
Return values
intgetX()
Get the X coordinate
public
getX() : int
Return values
intgetXObject()
Get the XObject
public
getXObject() : string
Return values
stringgetY()
Get the Y coordinate
public
getY() : int
Return values
intloadImageFromFile()
Load image from file
public
loadImageFromFile(string $imageFile[, array<string|int, mixed>|null $resize = null ][, bool $preserveResolution = false ]) : Parser
Parameters
- $imageFile : string
- $resize : array<string|int, mixed>|null = null
- $preserveResolution : bool = false
Tags
Return values
ParserloadImageFromStream()
Load image from stream
public
loadImageFromStream(string $imageStream[, array<string|int, mixed>|null $resize = null ][, bool $preserveResolution = false ]) : Parser
Parameters
- $imageStream : string
- $resize : array<string|int, mixed>|null = null
- $preserveResolution : bool = false
Tags
Return values
Parserparse()
Parse the image data and create the image objects
public
parse() : void
Tags
setIndex()
Set the image object index
public
setIndex(int $i) : Parser
Parameters
- $i : int
Return values
ParsersetX()
Set the X coordinate
public
setX(int $x) : Parser
Parameters
- $x : int
Return values
ParsersetY()
Set the Y coordinate
public
setY(int $y) : Parser
Parameters
- $y : int
Return values
ParserconvertImage()
Method to convert the image from GIF to PNG.
protected
convertImage() : void
createResource()
Create a new image resource based on the current image type of the image object.
protected
createResource() : void
parseImageData()
Parse image data
protected
parseImageData() : void
parseJpeg()
Parse the JPG image data
protected
parseJpeg() : void
parsePng()
Parse the PNG image data
protected
parsePng() : void
Tags
readInt()
Method to read an unsigned integer.
protected
readInt(string $data) : int
Parameters
- $data : string
Return values
intresizeImage()
Method to resize the image.
protected
resizeImage(array<string|int, mixed> $resize) : void
Parameters
- $resize : array<string|int, mixed>