Omeka_File_Derivative_Strategy_GD

Package: File\Derivative\Strategy

class Omeka_File_Derivative_Strategy_GD

extends Omeka_File_Derivative_AbstractStrategy

Strategy for making derivatives with the GD PHP library (default since 4.3).

Omeka_File_Derivative_Strategy_GD::__construct()

Check for the imagick extension at creation.

Omeka_File_Derivative_Strategy_GD::createImage($sourcePath, $destPath, $type, $sizeConstraint, $mimeType)

Generate a derivative image with GD.

Parameters:
  • $sourcePath

  • $destPath

  • $type

  • $sizeConstraint

  • $mimeType

Returns:

bool Returns true on success or false on failure.

Omeka_File_Derivative_Strategy_GD::_loadImageResource($source)

GD uses multiple functions to load an image, so this one manages all.

Parameters:
  • $source (string) – Path of the managed image file

Returns:

false|GD image ressource

Omeka_File_Derivative_Strategy_GD::_makeThumbnail($source, $destination, $sizeConstraint)

Make a thumbnail from source and save it at destination.

Parameters:
  • $source (string) – Path of the source.

  • $destination (string) – Path of the destination.

  • $sizeConstraint (int) – Maximum size in pixels.

Returns:

bool Returns true on success or false on failure.

Omeka_File_Derivative_Strategy_GD::_makeSquareThumbnail($source, $destination, $sizeConstraint)

Make a square thumbnail from source and save it at destination.

Parameters:
  • $source (string) – Path of the source.

  • $destination (string) – Path of the destination.

  • $sizeConstraint (int) – Maximum size in pixels.

Returns:

bool Returns true on success or false on failure.

Omeka_File_Derivative_Strategy_GD::_getOffsetX($width, $size)

Get the required offset on the X axis.

This respects the ‘gravity’ setting.

Parameters:
  • $width (int) – Original image width

  • $size (int) – Side size of the square region being selected

Returns:

int

Omeka_File_Derivative_Strategy_GD::_getOffsetY($height, $size)

Get the required offset on the Y axis.

This respects the ‘gravity’ setting.

Parameters:
  • $height (int) – Original image height

  • $size (int) – Side size of square region being selected

Returns:

int