CropImageAdjustment
class CropImageAdjustment extends AbstractImageAdjustment (View source)
An adjustment for cropping an image
Properties
protected int | $position | ||
protected ImageVariant | $imageVariant | from AbstractImageAdjustment | |
protected int | $x | ||
protected int | $y | ||
protected int | $width | ||
protected int | $height | ||
protected string | $aspectRatioAsString |
Methods
Sets height
Returns height
Sets width
Returns width
Sets x
Returns x
Sets y
Returns y
This setter accepts strings in order to make configuration / mapping of settings easier.
No description
Calculates the actual position and dimensions of the cropping area based on the given image dimensions and desired aspect ratio.
Check if this Adjustment can or should be applied to its ImageVariant.
Applies this adjustment to the given Imagine Image object
Refits the crop proportions to be the maximum size within the image boundaries.
Details
__construct(array $options = [])
Constructs this adjustment
void
setImageVariant(ImageVariant $imageVariant)
Sets the image variant this adjustment belongs to
int
getPosition()
No description
setPosition(int $position)
No description
void
setHeight(int $height = null)
Sets height
int|null
getHeight()
Returns height
void
setWidth(int $width = null)
Sets width
int|null
getWidth()
Returns width
void
setX(int $x = null)
Sets x
int|null
getX()
Returns x
void
setY(int $y = null)
Sets y
int|null
getY()
Returns y
void
setAspectRatio($aspectRatio = null)
This setter accepts strings in order to make configuration / mapping of settings easier.
AspectRatio|null
getAspectRatio()
No description
static array
calculateDimensionsByAspectRatio(int $originalWidth, int $originalHeight, AspectRatio $desiredAspectRatio)
Calculates the actual position and dimensions of the cropping area based on the given image dimensions and desired aspect ratio.
bool
canBeApplied(ImageInterface $image)
Check if this Adjustment can or should be applied to its ImageVariant.
ImageInterface
applyToImage(ImageInterface $image)
internal | Should never be used outside of the media package. Rely on the ImageService to apply your adjustments. |
Applies this adjustment to the given Imagine Image object
void
refit(ImageInterface $image)
Refits the crop proportions to be the maximum size within the image boundaries.