API Documentation for: 1.0.1
Show:

ImageResizer Class

Namespace: Canteen\Media

Handles image resize; can output to file or directly to browser. Located in the namespace Canteen\Media.

Constructor

ImageResizer

(
  • fileOriginal
  • [jpegQuality=85]
)

Parameters:

  • fileOriginal String

    The native path to the original file

  • [jpegQuality=85] Int optional

    The JPEG compression from 0 to 100

Methods

clear

() private

Clear all the class member varaibles

destroy

()

Destroy this instance and any temporary files

outputImage

(
  • destinationFile
  • imageType
  • image
)
Boolean private

Abstract method to save an image to a destination

Parameters:

  • destinationFile String

    The output file path

  • imageType String

    jpg or png

  • image Object

    The image resource

Returns:

Boolean:

If we saved the file successfully

outputOriginal

(
  • destinationFile
  • imageType
)
Boolean

Output the original image

Parameters:

  • destinationFile String

    The output location

  • imageType String

    The image type, jpg or png

Returns:

Boolean:

If we were successfully able to save

outputResized

(
  • destinationFile
  • imageType
)
Boolean

Output the resized image

Parameters:

  • destinationFile String

    The output location

  • imageType String

    The image type, jpg or png

Returns:

Boolean:

If we were successfully able to save

resize

(
  • desiredWidth
  • desiredHeight
  • [mode=self::RESIZE_MIN_FILL]
)

Resize the image

Parameters:

  • desiredWidth Int

    The desired output width, can be '*' for autosize

  • desiredHeight Int

    The desired output height, can be '*' for autosize

  • [mode=self::RESIZE_MIN_FILL] String optional

    The resize mode for the image

Properties

jpegQuality

Int

The JPEG quality from 0 to 100

Default: 85

RESIZE_DISTORT

String final static

Resize by distorting the image to file the whole size

RESIZE_MAX_FILL

String final static

Resize Mode to fill the entire area

RESIZE_MAX_FILL_CROP

String final static

Resize mode to fill and crop the image down

RESIZE_MIN_FILL

String final static

Fill to the minimum size

useGD2

Boolean private

If we should try to use the GD2 library

Default: true