PaulSchulz\SilverStripe\Gallery\Views\GalleryImage
This class represents an image of an image collection or a gallery.
All operations done on this object, like setScaleByWidth(), are not applied to the underlying image.
Instead $this->scale is changed, to just calculate the dimensions of this image for performance reasons.
Synopsis
class GalleryImage
extends ViewableData
{
- // members
- protected Image $image;
- protected integer $scale = 1;
- protected integer $lineWidth = 0;
- protected bool $hasMarginTop = true;
- protected bool $hasMarginRight = true;
- // methods
- public void __construct()
- public Image getImage()
- public static int getMargin()
- public void setLineWidth()
- public void setScaleByHeight()
- public void setScaleByWidth()
- public void setHasMarginTop()
- public void setHasMarginRight()
- public bool HasMarginTop()
- public bool HasMarginRight()
- public void scale()
- public float getScaledHeight()
- public float getScaledWidth()
- protected float getPercentageOfLineWidth()
- public float getPercentageWidth()
- public float getPercentageMargin()
- public DBHTMLText forTemplate()
Hierarchy
Extends
- SilverStripe\View\ViewableData
Members
protected
- $hasMarginRight
—
PaulSchulz\SilverStripe\Gallery\Views\bool
Determines if this image is rendered with margin at the right or not. - $hasMarginTop
—
PaulSchulz\SilverStripe\Gallery\Views\bool
Determines if this image is rendered with margin at the top or not. - $image — SilverStripe\Assets\Image
- $lineWidth
—
int
The width of the image line this image is wrapped in. - $scale
—
float
The scale factor of this image.
Methods
protected
- getPercentageOfLineWidth() — This function returns the value in $size as percentage of $this->lineWidth.
public
- __construct() — GalleryImage constructor.
- HasMarginRight() — Sets the value of $this->addMarginRight.
- HasMarginTop() — Returns the value $this->addMarginTop.
- forTemplate() — This function is called when this object should be rendered to a template.
- getImage() — Returns the underlying image.
- getMargin() — Returns the margin of an image. The margin is applied on the top and at the right of the image.
- getPercentageMargin() — Returns the margin of this image in percent of the width of one image line.
- getPercentageWidth() — Returns the width in percent of the wrapping line.
- getScaledHeight() — Returns the height of the image based on $this->scale.
- getScaledWidth() — Returns the height of the image based on $this->scale.
- scale() — Scales this image dimensions about the factor $scale.
- setHasMarginRight() — Sets the value of $this->addMarginRight.
- setHasMarginTop() — Sets the value of $this->addMarginTop.
- setLineWidth() — Sets the line width for the
- setScaleByHeight() — Sets the scale by the height of the image.
- setScaleByWidth() — Sets the scale by the width of the image.