Frame
in package
Represents one frame from the movie.
Table of Contents
- $EX_CODE_NO_VALID_RESOURCE : mixed
- $gdImageData : string
- GdImage binary data.
- $height : int
- Frame height in pixels.
- $pts : float
- Presentation time stamp.
- $width : int
- Frame width in pixels.
- __construct() : mixed
- Create a Frame object from a GD image.
- __serialize() : array<string|int, mixed>
- Return string representation of a Frame.
- __unserialize() : void
- Constructs the Frame from serialized data.
- crop() : void
- Crop the frame.
- getHeight() : int
- Return the height of the frame.
- getPresentationTimestamp() : float
- Return the presentation time stamp of the frame.
- getPTS() : float
- Return the presentation time stamp of the frame; alias $frame->getPresentationTimestamp().
- getWidth() : int
- Return the width of the frame.
- resize() : void
- Resize and optionally crop the frame. (Cropping is built into ffmpeg resizing so I'm providing it here for completeness.)
- toGDImage() : resource
- Returns a truecolor GD image of the frame.
- gdImageToBinaryData() : string
- Transforms gdImage resource to binary data.
Properties
$EX_CODE_NO_VALID_RESOURCE
protected
static mixed
$EX_CODE_NO_VALID_RESOURCE
= 334563
$gdImageData
GdImage binary data.
protected
string
$gdImageData
$height
Frame height in pixels.
protected
int
$height
$pts
Presentation time stamp.
protected
float
$pts
$width
Frame width in pixels.
protected
int
$width
Methods
__construct()
Create a Frame object from a GD image.
public
__construct(resource $gdImage[, float $pts = 0.0 ]) : mixed
Parameters
- $gdImage : resource
-
Image resource of type gd.
- $pts : float = 0.0
-
Frame presentation timestamp.
Tags
Return values
mixed —__serialize()
Return string representation of a Frame.
public
__serialize() : array<string|int, mixed>
Return values
array<string|int, mixed> —The string representation of the object or null.
__unserialize()
Constructs the Frame from serialized data.
public
__unserialize(array<string|int, mixed> $serialized) : void
Parameters
- $serialized : array<string|int, mixed>
-
The string representation of Frame instance.
Return values
void —crop()
Crop the frame.
public
crop(int $cropTop, int $cropBottom, int $cropLeft, int $cropRight) : void
NOTE: Crop values must be even numbers.
Parameters
- $cropTop : int
-
Rows of pixels removed from the top of the frame.
- $cropBottom : int
-
Rows of pixels removed from the bottom of the frame.
- $cropLeft : int
-
Rows of pixels removed from the left of the frame.
- $cropRight : int
-
Rows of pixels removed from the right of the frame.
Return values
void —getHeight()
Return the height of the frame.
public
getHeight() : int
Return values
int —getPresentationTimestamp()
Return the presentation time stamp of the frame.
public
getPresentationTimestamp() : float
Return values
float —getPTS()
Return the presentation time stamp of the frame; alias $frame->getPresentationTimestamp().
public
getPTS() : float
Return values
float —getWidth()
Return the width of the frame.
public
getWidth() : int
Return values
int —resize()
Resize and optionally crop the frame. (Cropping is built into ffmpeg resizing so I'm providing it here for completeness.)
public
resize(int $width, int $height, int $cropTop, int $cropBottom, int $cropLeft, int $cropRight) : void
NOTE: Cropping is always applied to the frame before it is resized. Crop values must be even numbers.
Parameters
- $width : int
-
New width of the frame (must be an even number).
- $height : int
-
New height of the frame (must be an even number).
- $cropTop : int
-
Rows of pixels removed from the top of the frame.
- $cropBottom : int
-
Rows of pixels removed from the bottom of the frame.
- $cropLeft : int
-
Rows of pixels removed from the left of the frame.
- $cropRight : int
-
Rows of pixels removed from the right of the frame.
Return values
void —toGDImage()
Returns a truecolor GD image of the frame.
public
toGDImage() : resource
Return values
resource —Resource of type gd.
gdImageToBinaryData()
Transforms gdImage resource to binary data.
protected
gdImageToBinaryData(resource $gdImage) : string
Parameters
- $gdImage : resource