$config
$config : \Config\Images
Configuration settings.
Base image handling implementation
$config : \Config\Images
Configuration settings.
$image : \CodeIgniter\Images\Image
The image/file instance
getFile() : \CodeIgniter\Images\Image
Returns the image instance.
resize(integer $width, integer $height, boolean $maintainRatio = false, string $masterDim = 'auto') : \CodeIgniter\Images\Handlers\BaseHandler
Resize the image
integer | $width | |
integer | $height | |
boolean | $maintainRatio | If true, will get the closest match possible while keeping aspect ratio true. |
string | $masterDim |
crop(integer|null $width = null, integer|null $height = null, integer|null $x = null, integer|null $y = null, boolean $maintainRatio = false, string $masterDim = 'auto') : mixed
Crops the image to the desired height and width. If one of the height/width values is not provided, that value will be set the appropriate value based on offsets and image dimensions.
integer|null | $width | |
integer|null | $height | |
integer|null | $x | X-axis coord to start cropping from the left of image |
integer|null | $y | Y-axis coord to start cropping from the top of image |
boolean | $maintainRatio | |
string | $masterDim |
convert(integer|null $imageType) : $this
Changes the stored image type to indicate the new file format to use when saving.
Does not touch the actual resource.
integer|null | $imageType | A PHP imageType constant, e.g. https://www.php.net/manual/en/function.image-type-to-mime-type.php |
text(string $text, array $options = array()) : $this
Overlays a string of text over the image.
Valid options:
string | $text | |
array | $options |
reorient(boolean $silent = false) : $this
Reads the EXIF information from the image and modifies the orientation so that displays correctly in the browser. This is especially an issue with images taken by smartphones who always store the image up-right, but set the orientation flag to display it correctly.
boolean | $silent | If true, will ignore exceptions when PHP doesn't support EXIF. |
getEXIF(string|null $key = null, boolean $silent = false) : mixed
Retrieve the EXIF information from the image, if possible. Returns an array of the information, or null if nothing can be found.
EXIF data is only supported fr JPEG & TIFF formats.
string|null | $key | If specified, will only return this piece of EXIF data. |
boolean | $silent | If true, will not throw our own exceptions. |
fit(integer $width, integer $height = null, string $position = 'center') : boolean
Combine cropping and resizing into a single command.
Supported positions:
integer | $width | |
integer | $height | |
string | $position |
reproportion() : void
Re-proportion Image Width/Height
When creating thumbs, the desired width/height can end up warping the image due to an incorrect ratio between the full-sized image and the thumb.
This function lets us re-proportion the width/height if users choose to maintain the aspect ratio when resizing.