Skip to content

PhotoDriver

  • Full name: \Zotlabs\Photo\PhotoDriver
  • This class is an Abstract class

Properties

image

protected resource|\Imagick $image

width

protected int $width

height

protected int $height

valid

protected bool $valid

type

protected string $type

types

protected array $types

Methods

supportedTypes

public supportedTypes(): array
  • This method is abstract.

Return Value:

Associative array with mimetype as key and file extension as value.


load

protected load(mixed $data, mixed $type): mixed
  • This method is abstract.

Parameters:

Parameter Type Description
$data mixed
$type mixed

destroy

protected destroy(): mixed
  • This method is abstract.

setDimensions

protected setDimensions(): mixed
  • This method is abstract.

getImage

public getImage(): bool|resource|\Imagick
  • This method is abstract.

Return Value:

false on failure, a PHP image resource for GD driver, an \Imagick object for ImageMagick driver.


doScaleImage

public doScaleImage(mixed $new_width, mixed $new_height): mixed
  • This method is abstract.

Parameters:

Parameter Type Description
$new_width mixed
$new_height mixed

rotate

public rotate(mixed $degrees): mixed
  • This method is abstract.

Parameters:

Parameter Type Description
$degrees mixed

flip

public flip(mixed $horiz = true, mixed $vert = false): mixed
  • This method is abstract.

Parameters:

Parameter Type Description
$horiz mixed
$vert mixed

cropImageRect

public cropImageRect(int $maxx, int $maxy, int $x, int $y, int $w, int $h): bool|void
  • This method is abstract.

Parameters:

Parameter Type Description
$maxx int width of the new image
$maxy int height of the new image
$x int x-offset for region
$y int y-offset for region
$w int width of region
$h int height of region

Return Value:

false on failure


imageString

public imageString(): string
  • This method is abstract.

Return Value:

A Binary String.


clearexif

public clearexif(): mixed
  • This method is abstract.

__construct

public __construct(string $data, string $type = ''): mixed

Parameters:

Parameter Type Description
$data string Image
$type string mimetype

__destruct

public __destruct(): mixed

is_valid

public is_valid(): bool

getWidth

public getWidth(): bool|\Zotlabs\Photo\number

Return Value:

Width of image in pixels, or false on failure


getHeight

public getHeight(): bool|\Zotlabs\Photo\number

Return Value:

Height of image in pixels, or false on failure


saveImage

public saveImage(string $path): bool

Parameters:

Parameter Type Description
$path string Path and filename where to save the image

Return Value:

False on failure, otherwise true


getType

public getType(): bool|string

Return Value:

False on failure, otherwise mimetype.


getExt

public getExt(): bool|string

Return Value:

False on failure, otherwise file extension.


scaleImage

public scaleImage(int $max, bool $float_height = true): bool|void

Parameters:

Parameter Type Description
$max int maximum pixel size in either dimension
$float_height bool (optional)
If true allow height to float to any length on tall images, constraining
only the width

Return Value:

false on failure, otherwise void


scaleImageUp

public scaleImageUp(mixed $min): mixed

Parameters:

Parameter Type Description
$min mixed

scaleImageSquare

public scaleImageSquare(int $dim): bool|void

Parameters:

Parameter Type Description
$dim int Pixel of square image

Return Value:

false on failure, otherwise void


cropImage

public cropImage(int $max, int $x, int $y, int $w, int $h): bool|void

Parameters:

Parameter Type Description
$max int size of the new image
$x int x-offset for region
$y int y-offset for region
$w int width of region
$h int height of region

Return Value:

false on failure

See Also:

  • \Zotlabs\Photo\cropImageRect() -

exif

public exif(string $filename): bool|array

Parameters:

Parameter Type Description
$filename string

orient

public orient(array $exif): bool

Parameters:

Parameter Type Description
$exif array

Return Value:

true if oriented, otherwise false


save

public save(array $arr, bool $skipcheck = false): bool|array

Parameters:

Parameter Type Description
$arr array
$skipcheck bool (optional) default false

storeThumbnail

public storeThumbnail(array $arr, mixed $scale): bool

Parameters:

Parameter Type Description
$arr array
$scale mixed


Automatically generated on 2025-03-19