ExtractedImage
in package
An extracted sub-image.
Table of Contents
Properties
- $elementId : int
- $filename : string
- $image : Imagick
- $pageId : int
- $saveFormat : string
Methods
- __construct() : mixed
- Initializes a new instance of the ExtractedImage class.
- asInputSource() : BytesInput
- Returns the image in a format suitable for sending to a client for parsing.
- writeToFile() : void
- Writes the image to a file.
- getEncodedImageFormat() : string
- Get the encoded image format.
Properties
$elementId
public
int
$elementId
Element ID of the image.
$filename
public
string
$filename
Name of the file.
$image
public
Imagick
$image
Wrapper for the image.
$pageId
public
int
$pageId
Page ID of the image.
$saveFormat
protected
string
$saveFormat
String representation of the save format.
Methods
__construct()
Initializes a new instance of the ExtractedImage class.
public
__construct(mixed $image, string $filename, string $saveFormat, int $pageIndex, int $index) : mixed
Parameters
- $image : mixed
-
The extracted image. Not explicitly typed as \Imagick to avoid errors.
- $filename : string
-
The filename for the image.
- $saveFormat : string
-
The format to save the image.
- $pageIndex : int
-
The page index of the image.
- $index : int
-
The element index of the image.
Tags
asInputSource()
Returns the image in a format suitable for sending to a client for parsing.
public
asInputSource() : BytesInput
Tags
Return values
BytesInput —Bytes input for the image.
writeToFile()
Writes the image to a file.
public
writeToFile(string $outputPath[, null|string $format = null ][, int $quality = 100 ]) : void
Uses the default image format and filename.
Parameters
- $outputPath : string
-
The output directory (must exist).
- $format : null|string = null
-
The image format to use. Defaults to the save format if not provided.
- $quality : int = 100
-
Quality of the saved image.
Tags
getEncodedImageFormat()
Get the encoded image format.
private
getEncodedImageFormat(string $saveFormat) : string
Parameters
- $saveFormat : string
-
Format to save the file as.
Return values
string —Encoded image format.