Functions
Function | Description |
---|---|
centerCrop |
Crop from the center of an image to create a new one. |
checkMemory |
Checks whether there is enough memory available to perform an image manipulation. |
copy |
Copies the image to a new location. |
crop |
Creates a cropped image. |
destroy |
Deletes the source image. |
fixRotation |
Checks EXIF image data and rotates the image if rotation flags are set. |
filterGeneratableCrops |
Filters the array of crops to only those which can be generated by this image. |
getLargestCrop |
Finds the largest crop from a crop set and returns the width and height dimensions. |
getLargestThumbnail |
Finds the largest thumbnail from a crop set and returns the width and height dimensions. |
getPrefixArray |
Parses an array of crops, thumbnails, and center crops and returns an array of prefixes |
getThumbnailSize |
Returns a width and height that are constrained to the passed in max width and height. |
getTempFileName |
Returns a temporary file name of the proper extension. |
getUpscaleSize |
Returns a width and height that are scaled up to the passed in min width and height. |
processCenterCrops |
Parses the image settings center_crops array and runs/stores crops. |
processCrops |
Parses the image settings crops array and runs any exact crops. |
processThumbnails |
Parses the image settings thumbs array and runs/stores thumbnails. |
replace |
Stores a temporary file in its permanant location replacing any file that may exist at the location. |
store |
Stores a temporary file in its permanant location. |
thumbnail |
Creates a thumbnailed image. |
restoreMemoryLimit |
Restores the saved memory limit after image processing is complete. |
setImageMemoryLimit |
Increases the memory limit of PHP for image processing and saves the current limit. |
upscale |
Creates a upscaled image from a source image. |
centerCrop
Crop from the center of an image to create a new one.
Return Value: The new file name if successful, false if there was not enough memory available.
centerCrop($location, $crop_width, $crop_height, $retina = false, $grayscale = false)
Parameter | Description |
---|---|
$location |
The location to save the new cropped image (pass null to replace the source image). |
$crop_width |
The crop width. |
$crop_height |
The crop height. |
$retina |
Whether to try to create a retina crop (2x, defaults false) |
$grayscale |
Whether to convert to grayscale (defaults false) |
checkMemory
Checks whether there is enough memory available to perform an image manipulation.
Return Value: true if the image can be created, otherwise false.
checkMemory($width, $height)
Parameter | Description |
---|---|
$width |
The width of the new image to be created |
$height |
The height of the new image to be created |
copy
Copies the image to a new location.
Return Value: A new BigTreeImage object for the new file or null if copy failed.
copy($location = null)
Parameter | Description |
---|---|
$location |
The new location (leave empty to copy to a temporary file). |
crop
Creates a cropped image.
Return Value: The new file name if successful, false if there was not enough memory available or an invalid source image was provided.
crop($location, $x, $y, $target_width, $target_height, $width, $height, $retina = false, $grayscale = false)
Parameter | Description |
---|---|
$location |
The location to save the new cropped image (pass null to replace the source image). |
$x |
The starting x value of the crop. |
$y |
The starting y value of the crop. |
$target_width |
The desired width of the new image. |
$target_height |
The desired height of the new image. |
$width |
The width to crop from the original image. |
$height |
The height to crop from the original image. |
$retina |
Whether to create a retina-style image (2x, lower quality) if able, defaults to false |
$grayscale |
Whether to make the crop be in grayscale or not, defaults to false |
destroy
Deletes the source image.
destroy()
fixRotation
Checks EXIF image data and rotates the image if rotation flags are set.
fixRotation()
filterGeneratableCrops
Filters the array of crops to only those which can be generated by this image.
filterGeneratableCrops()
getLargestCrop
Finds the largest crop from a crop set and returns the width and height dimensions.
Return Value: An array with width and height keys.
getLargestCrop()
getLargestThumbnail
Finds the largest thumbnail from a crop set and returns the width and height dimensions.
Return Value: An array with width and height keys.
getLargestThumbnail()
getPrefixArray
Parses an array of crops, thumbnails, and center crops and returns an array of prefixes
Return Value: A modified array of file prefixes.
getPrefixArray()
getThumbnailSize
Returns a width and height that are constrained to the passed in max width and height.
Return Value: An array with "width" and "height" keys.
getThumbnailSize($max_width, $max_height, $width_override = null, $height_override = null)
Parameter | Description |
---|---|
$max_width |
The maximum width of the new image (0 for no max) |
$max_height |
The maximum height of the new image (0 for no max) |
$width_override |
Set another value to use for source width (defaults to $this->Width) |
$height_override |
Set another value to use for source height (defaults to $this->Height) |
getTempFileName
Returns a temporary file name of the proper extension.
getTempFileName()
getUpscaleSize
Returns a width and height that are scaled up to the passed in min width and height.
Return Value: An array with "width" and "height" keys.
getUpscaleSize($min_width, $min_height)
Parameter | Description |
---|---|
$min_width |
The minimum width of the new image (0 for no min). |
$min_height |
The maximum height of the new image (0 for no min). |
processCenterCrops
Parses the image settings center_crops array and runs/stores crops.
Must be run after store() method has been called.
processCenterCrops()
processCrops
Parses the image settings crops array and runs any exact crops.
Must be run after store() method has been called.
Return Value: An array of crops that will need to be processed.
processCrops()
processThumbnails
Parses the image settings thumbs array and runs/stores thumbnails.
Must be run after store() method has been called.
processThumbnails()
replace
Stores a temporary file in its permanant location replacing any file that may exist at the location.
Return Value: The full file path (and sets $this->StoredName) or null if the image failed to store (sets $this->Error).
replace($name, $force_local = false)
Parameter | Description |
---|---|
$name |
Desired file name |
$force_local |
true forces a local replacement (in the event the file is local but cloud is set as default) |
store
Stores a temporary file in its permanant location.
Return Value: The full file path (and sets $this->StoredName) or null if the image failed to store (sets $this->Error).
store($name)
Parameter | Description |
---|---|
$name |
Desired file name |
thumbnail
Creates a thumbnailed image.
Return Value: The new file name if successful, false if there was not enough memory available or an invalid source image was provided.
thumbnail($location, $width, $height, $retina = false, $grayscale = false, $upscale = false)
Parameter | Description |
---|---|
$location |
The location to save the new cropped image (pass null to replace the source image). |
$width |
The maximum width of the new image (0 for no max). |
$height |
The maximum height of the new image (0 for no max). |
$retina |
Whether to create a retina-style image (2x, lower quality) if able (defaults to false). |
$grayscale |
Whether to make the crop be in grayscale or not (defaults to false). |
$upscale |
If set to true, upscales to the width / height instead of downscaling (defaults to false, disables retina). |
restoreMemoryLimit
Restores the saved memory limit after image processing is complete.
static restoreMemoryLimit()
setImageMemoryLimit
Increases the memory limit of PHP for image processing and saves the current limit.
static setImageMemoryLimit()
upscale
Creates a upscaled image from a source image.
Return Value: The new file name if successful, false if there was not enough memory available or an invalid source image was provided.
upscale($location, $min_width, $min_height)
Parameter | Description |
---|---|
$location |
The location to save the new cropped image (pass null to replace the source image). |
$min_width |
The minimum width of the new image (0 for no max). |
$min_height |
The minimum height of the new image (0 for no max). |