Documentation

Parser
in package

Pdf image parser class

Tags
category

Pop

author

Nick Sagona, III dev@nolainteractive.com

copyright

Copyright (c) 2009-2023 NOLA Interactive, LLC. (http://www.nolainteractive.com)

license

http://www.popphp.org/license New BSD License

version
4.2.0

Table of Contents

$alpha  : bool
Flag for if the image has an alpha channel
$basename  : string
Image basename
$channels  : int
Number of channels in the image
$colorMode  : mixed
Image color mode
$colorTotal  : int
Image total number of colors
$convertedImage  : string
Converted GIF to PNG image
$depth  : int
Image bit-depth
$extension  : string
Image extension
$filename  : string
Image filename
$fullpath  : string
Image fullpath
$height  : int
Image height
$imageData  : mixed
Image data
$imageDataLength  : int
Image data length
$index  : int
Image object index
$mime  : string
Image mime
$objects  : array<string|int, mixed>
Image objects
$resize  : array<string|int, mixed>
Image resize value
$resizedImage  : string
Resized image
$resource  : resource
GD image resource
$stream  : string
Image stream
$width  : int
Image width
$x  : int
Image X Coordinate
$y  : int
Image Y Coordinate
__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
Get the converted image
getHeight()  : int
Get the height
getIndex()  : int
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 $basename = null

$channels

Number of channels in the image

protected int $channels = 0

$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 $convertedImage = null

$depth

Image bit-depth

protected int $depth = 0

$extension

Image extension

protected string $extension = null

$filename

Image filename

protected string $filename = null

$fullpath

Image fullpath

protected string $fullpath = null

$height

Image height

protected int $height = 0

$imageData

Image data

protected mixed $imageData = null

$imageDataLength

Image data length

protected int $imageDataLength = null

$index

Image object index

protected int $index = null

$mime

Image mime

protected string $mime = null

$objects

Image objects

protected array<string|int, mixed> $objects = []

$resize

Image resize value

protected array<string|int, mixed> $resize = null

$resizedImage

Resized image

protected string $resizedImage = null

$resource

GD image resource

protected resource $resource = null

$stream

Image stream

protected string $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
Return values
mixed

convertToJpeg()

Method to convert the image to Jpg

public convertToJpeg([int $quality = 70 ]) : void
Parameters
$quality : int = 70
Return values
void

createImageFromFile()

Create image from file

public static createImageFromFile(string $imageFile, int $x, int $y[, array<string|int, mixed> $resize = null ][, bool $preserveResolution = false ]) : Parser
Parameters
$imageFile : string
$x : int
$y : int
$resize : array<string|int, mixed> = null
$preserveResolution : bool = false
Return values
Parser

createImageFromStream()

Create image from stream

public static createImageFromStream(string $imageStream, int $x, int $y[, array<string|int, mixed> $resize = null ][, bool $preserveResolution = false ]) : Parser
Parameters
$imageStream : string
$x : int
$y : int
$resize : array<string|int, mixed> = null
$preserveResolution : bool = false
Return values
Parser

getConvertedImage()

Get the converted image

public getConvertedImage() : string
Return values
string

getHeight()

Get the height

public getHeight() : int
Return values
int

getIndex()

Get the image object index

public getIndex() : int
Return values
int

getObjects()

Get the image objects

public getObjects() : array<string|int, mixed>
Return values
array<string|int, mixed>

getStream()

Get the image stream

public getStream() : string
Return values
string

getWidth()

Get the width

public getWidth() : int
Return values
int

getX()

Get the X coordinate

public getX() : int
Return values
int

getXObject()

Get the XObject

public getXObject() : string
Return values
string

getY()

Get the Y coordinate

public getY() : int
Return values
int

loadImageFromFile()

Load image from file

public loadImageFromFile(string $imageFile[, array<string|int, mixed> $resize = null ][, bool $preserveResolution = false ]) : Parser
Parameters
$imageFile : string
$resize : array<string|int, mixed> = null
$preserveResolution : bool = false
Return values
Parser

loadImageFromStream()

Load image from stream

public loadImageFromStream(string $imageStream[, array<string|int, mixed> $resize = null ][, bool $preserveResolution = false ]) : Parser
Parameters
$imageStream : string
$resize : array<string|int, mixed> = null
$preserveResolution : bool = false
Return values
Parser

parse()

Parse the image data and create the image objects

public parse() : void
Tags
throws
Exception
Return values
void

setIndex()

Set the image object index

public setIndex(int $i) : Parser
Parameters
$i : int
Return values
Parser

setX()

Set the X coordinate

public setX(int $x) : Parser
Parameters
$x : int
Return values
Parser

setY()

Set the Y coordinate

public setY(int $y) : Parser
Parameters
$y : int
Return values
Parser

convertImage()

Method to convert the image from GIF to PNG.

protected convertImage() : void
Return values
void

createResource()

Create a new image resource based on the current image type of the image object.

protected createResource() : void
Return values
void

parseImageData()

Parse image data

protected parseImageData() : void
Return values
void

parseJpeg()

Parse the JPG image data

protected parseJpeg() : void
Tags
throws
Exception
Return values
void

parsePng()

Parse the PNG image data

protected parsePng() : void
Tags
throws
Exception
Return values
void

readInt()

Method to read an unsigned integer.

protected readInt(string $data) : int
Parameters
$data : string
Return values
int

resizeImage()

Method to resize the image.

protected resizeImage(array<string|int, mixed> $resize) : void
Parameters
$resize : array<string|int, mixed>
Tags
throws
Exception
Return values
void

Search results