interface ImageInterface implements ResourceBasedInterface (View source)

Interface of an Image

Constants

ORIENTATION_SQUARE

ORIENTATION_LANDSCAPE

ORIENTATION_PORTRAIT

RATIOMODE_INSET

Inset ratio mode: If an image is attempted to get scaled with the size of both edges stated, using this mode will scale it to the lower of both edges.

Consider an image of 320/480 being scaled to 50/50: because aspect ratio wouldn't get hurt, the target image size will become 33/50.

RATIOMODE_OUTBOUND

Outbound ratio mode: If an image is attempted to get scaled with the size of both edges stated, using this mode will scale the image and crop it.

Consider an image of 320/480 being scaled to 50/50: the image will be scaled to height 50, then centered and cropped so the width will also be 50.

Methods

PersistentResource
getResource()

Returns the PersistentResource

void
refresh()

Refreshes this asset after the PersistentResource has been modified

int
getWidth()

Width of the image in pixels

int
getHeight()

Height of the image in pixels

float
getAspectRatio(bool $respectOrientation = false)

Edge / aspect ratio of the image

string
getOrientation()

Orientation of this image, i.e. portrait, landscape or square

bool
isOrientationSquare()

Whether this image is square aspect ratio and therefore has a square orientation

bool
isOrientationLandscape()

Whether this image is in landscape orientation

bool
isOrientationPortrait()

Whether this image is in portrait orientation

Details

PersistentResource getResource()

Returns the PersistentResource

Return Value

PersistentResource

void refresh()

Refreshes this asset after the PersistentResource has been modified

Return Value

void

int getWidth()

Width of the image in pixels

Return Value

int

int getHeight()

Height of the image in pixels

Return Value

int

float getAspectRatio(bool $respectOrientation = false)

Edge / aspect ratio of the image

Parameters

bool $respectOrientation

If false (the default), orientation is disregarded and always a value >= 1 is returned (like usual in "4 / 3" or "16 / 9")

Return Value

float

string getOrientation()

Orientation of this image, i.e. portrait, landscape or square

Return Value

string

One of this interface's ORIENTATION_* constants.

bool isOrientationSquare()

Whether this image is square aspect ratio and therefore has a square orientation

Return Value

bool

bool isOrientationLandscape()

Whether this image is in landscape orientation

Return Value

bool

bool isOrientationPortrait()

Whether this image is in portrait orientation

Return Value

bool