Codem\Thumbor\Image
A Thumbor image object that extends Image and overrides various methods
Synopsis
class Image
extends Image
{
- // members
- private static string $table_name = "ThumborImage";
- private static string $default_classname = "SilverStripe\Assets\Image";
- private $image_backend = NULL;
- private integer $_cache_width = 0;
- private integer $_cache_height = 0;
- // methods
- public void __construct()
- public void onBeforeWrite()
- public void getImageBackend()
- public void getUrlInstance()
- public void getWidth()
- public void getHeight()
- public Object|DBField obj()
- public void Resampled()
- public void manipulate()
- public void manipulateImage()
- public void Restart()
- public void ResetFilters()
- public void Align()
- public void Smart()
- public void Filters()
- public void Filter()
- public void ManualCropFromCorners()
- public void Focal()
- public void CroppedFocus()
- public void ManualCrop()
- public void FlipVertical()
- public void FlipHorizontal()
- public void ScaleWidthFlipVertical()
- public void ScaleWidthFlipHorizontal()
- public void Original()
- public void getSocialProviderConfig()
- public void Social()
- public void ScaleWidth()
- public ThumboredImage ScaleMaxWidth()
- public void Fill()
- public ThumboredImage FillMax()
- public ThumboredImage CropHeight()
- public ThumboredImage CropWidth()
- public ThumboredImage ScaleHeight()
- public AssetContainer ScaleMaxHeight()
- public ThumboredImage ResizedImage()
- public ThumboredImage Pad()
- public void Fit()
- public void FitMax()
- public void CroppedFocusedImage()
Hierarchy
Extends
- SilverStripe\Assets\Image
Tasks
Line | Task |
---|---|
15+ | maybe the overriding methods e.g ScaleWidth to the {@link Codem\Thumbor\ThumbyllaImageBackend} and access them via {@link SilverStripe\Assets\ImageManipulation} |
496+ | provide a field to allow manual cropping |
Members
private
- $_cache_height
- $_cache_width
- $default_classname
- $image_backend
- $table_name
Methods
public
- __construct()
- Align() — Align the crop (for Fill/CroppedImage)
- CropHeight() — Crop image on Y axis if it exceeds specified height. Retain width.
- CropWidth() — Crop image on X axis if it exceeds specified width. Retain height.
- CroppedFocus() — Return a {@link Codem\Thumbor\Image} with a focal filter set based on the date returned from ManualCropData
- CroppedFocusedImage()
- Fill() — Return URL representing an image resized/cropped to fill specified dimensions
- FillMax() — Crop this image to the aspect ratio defined by the specified width and height, then scale down the image to those dimensions if it exceeds them.
- Filter() — Add single filter
- Filters() — Add multiple filters
- Fit() — Scale image proportionally to fit within the specified bounds, thumbor handles sanity checking
- FitMax()
- FlipHorizontal()
- FlipVertical() — Some specific Thumbor image handling
- Focal() — Supply focal per http://thumbor.readthedocs.io/en/latest/focal.html, noting this warning: http://thumbor.readthedocs.io/en/latest/focal.html#warning
- ManualCrop() — Crop the image using Thumbor manual crop handling based on image crop data
- ManualCropFromCorners() — Shortcut method to crop an image from its edges, e.g 20,20,20,20 crops the image 20 pixels in from each edge
- Original()
- Pad() — Fit image to specified dimensions and fill leftover space with a solid colour (default white). Use in templates with $Pad.
- Resampled()
- ResetFilters() — Alias for Restart()
- ResizedImage() — Note that Thumbor avoids skewing images, so this may not return what you expect
- Restart() — As filters are chainable, getting multiple manipulations in a template on the same image can result in filters being retained for another manipulation of the same image
- ScaleHeight() — Scale image proportionally by height. Use in templates with $ScaleHeight.
- ScaleMaxHeight() — Proportionally scale down this image if it is taller than the specified height.
- ScaleMaxWidth() — Proportionally scale down this image if it is wider than the specified width.
- ScaleWidth() — Return URL representing an image scaled to the provided width
- ScaleWidthFlipHorizontal()
- ScaleWidthFlipVertical()
- Smart() — Enable Smart Cropping on this instance. It cannot be turned off once enabled.
- Social()
- getHeight() — Return the height of the original image uploaded
- getImageBackend()
- getSocialProviderConfig()
- getUrlInstance() — Helper method to get the current Thumbor URL Builder instance
- getWidth() — Return the width of the original image uploaded
- manipulate() — Overrides ImageManipulation trait
- manipulateImage() — Overrides ImageManipulation trait
- obj() — Override {@link ViewableData::obj()} to avoid getting previous filter requests from the Viewable data objCache
- onBeforeWrite() — Ensure that the ClassName value saved is the original SS Image classname