SilverStripe\Assets\Storage\DBFile
Represents a file reference stored in a database
Synopsis
class DBFile
extends DBComposite
implements
AssetContainer,Thumbnail
{
- // members
- protected array $allowedCategories = ;
- private static array $supported_images = ;
- private static array $composite_db = ;
- private static array $casting = ;
- // methods
- public void __construct()
- public boolean getIsImage()
- protected AssetStore getStore()
- public void scaffoldFormField()
- public string XML()
- public string getTag()
- public string getFrontendTemplate()
- public string getBasename()
- public string getExtension()
- public string getTitle()
- public void setFromLocalFile()
- public void setFromStream()
- public void setFromString()
- public void getStream()
- public void getString()
- public void getURL()
- public string Link()
- public string AbsoluteLink()
- public string getSourceURL()
- public string getAbsoluteURL()
- public void getMetaData()
- public void getMimeType()
- public void getValue()
- public void getVisibility()
- public void exists()
- public void getFilename()
- public void getHash()
- public void getVariant()
- public int getAbsoluteSize()
- public $this setOriginal()
- public array getAllowedCategories()
- public $this setAllowedCategories()
- protected array getAllowedExtensions()
- protected bool isValidFilename()
- protected void assertFilenameValid()
- public bool validate()
- public void setField()
- public string|false getSize()
- public void deleteFile()
- public void publishFile()
- public void protectFile()
- public void grantFile()
- public void revokeFile()
- public void canViewFile()
- public void renameFile()
- public void copyFile()
- // Inherited methods from ImageManipulation
- public $this setAllowGeneration()
- public bool getAllowGeneration()
- public DBFile existingOnly()
- public abstract string getString()
- public abstract resource getStream()
- public abstract string getURL()
- public abstract string getAbsoluteURL()
- public abstract array|null getMetaData()
- public abstract string getMimeType()
- public abstract int getAbsoluteSize()
- public abstract bool exists()
- public abstract string getFilename()
- public abstract string getHash()
- public abstract string getVariant()
- public abstract bool getIsImage()
- public AssetContainer Pad()
- public AssetContainer Resampled()
- public void updateURL()
- public AssetContainer ResizedImage()
- public AssetContainer Fit()
- public AssetContainer FitMax()
- public AssetContainer ScaleWidth()
- public AssetContainer ScaleMaxWidth()
- public AssetContainer ScaleHeight()
- public AssetContainer ScaleMaxHeight()
- public AssetContainer CropWidth()
- public AssetContainer CropHeight()
- public AssetContainer FillMax()
- public AssetContainer Fill()
- public AssetContainer Quality()
- public DBFile|DBHTMLText CMSThumbnail()
- public AssetContainer|DBHTMLText StripThumbnail()
- public AssetContainer|DBHTMLText PreviewThumbnail()
- public AssetContainer Thumbnail()
- public AssetContainer|DBHTMLText ThumbnailIcon()
- public DBHTMLText IconTag()
- public string ThumbnailURL()
- public string getIcon()
- public Image_Backend getImageBackend()
- public $this setImageBackend()
- public int getWidth()
- public int getHeight()
- public int getOrientation()
- public boolean isSize()
- public boolean isWidth()
- public boolean isHeight()
- public DBFile manipulateImage()
- public DBFile manipulate()
- public string variantName()
- public array|null variantParts()
- protected int castDimension()
- public AssetContainer setAttribute()
- public void initAttributes()
- protected void getDefaultAttributes()
- public array getAttributes()
- public bool IsLazyLoaded()
- public AssetContainer LazyLoad()
Hierarchy
Extends
- SilverStripe\ORM\FieldType\DBComposite
Uses
Implements
Members
private
- $casting
- $composite_db
- $supported_images
—
array
List of image mime types supported by the image manipulations API
protected
- $allowGeneration
—
SilverStripe\Assets\bool
If image resizes are allowed - $allowedCategories
—
array
List of allowed file categories. - $imageBackend — SilverStripe\Assets\Image_Backend
Methods
protected
- assertFilenameValid() — Check filename, and raise a ValidationException if invalid
- getAllowedExtensions() — Gets the list of extensions (if limited) for this field. Empty list means there is no restriction on allowed types.
- getStore()
- isValidFilename() — Validate that this DBFile accepts this filename as valid
public
- __construct() — Create a new image manipulation
- AbsoluteLink() — Return absolute URL for this image. Alias for getAbsoluteURL()
- Link() — Return URL for this image. Alias for getURL()
- XML() — Return a html5 tag of the appropriate for this file (normally img or a)
- canViewFile()
- copyFile()
- deleteFile()
- exists()
- getAbsoluteSize() — Return file size in bytes.
- getAbsoluteURL() — Get the absolute URL to this resource
- getAllowedCategories() — Get list of allowed file categories
- getBasename() — Get trailing part of filename
- getExtension() — Get file extension
- getFilename()
- getFrontendTemplate() — Determine the template to render as on the frontend
- getHash()
- getIsImage() — Determine if a valid non-empty image exists behind this asset, which is a format compatible with image manipulations
- getMetaData()
- getMimeType()
- getSize() — Returns the size of the file type in an appropriate format.
- getSourceURL() — Get URL, but without resampling.
- getStream()
- getString()
- getTag() — Return a html5 tag of the appropriate for this file (normally img or a)
- getTitle() — Alt title for this
- getURL()
- getValue()
- getVariant()
- getVisibility()
- grantFile()
- protectFile()
- publishFile()
- renameFile()
- revokeFile()
- scaffoldFormField()
- setAllowedCategories() — Assign allowed categories
- setField()
- setFromLocalFile()
- setFromStream()
- setFromString()
- setOriginal() — Customise this object with an "original" record for getting other customised fields
- validate() — Hook to validate this record against a validation result
Inherited from SilverStripe\Assets\ImageManipulation
protected
- castDimension() — Validate a width or size is valid and casts it to integer
- getDefaultAttributes()
public
- CMSThumbnail() — Default CMS thumbnail
- 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.
- Fill() — Resize and crop image 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.
- Fit() — Scale image proportionally to fit within the specified bounds
- FitMax() — Proportionally scale down this image if it is wider or taller than the specified dimensions.
- IconTag() — Get HTML for img containing the icon for this file
- IsLazyLoaded() — Determine whether the image should be lazy loaded
- LazyLoad() — Set the lazy loading state for this Image
- Pad() — Fit image to specified dimensions and fill leftover space with a solid colour (default white). Use in templates with $Pad.
- PreviewThumbnail() — Get preview for this file
- Quality() — Set the quality of the resampled image
- Resampled() — Forces the image to be resampled, if possible
- ResizedImage() — Generate a resized copy of this image with the given width & height.
- 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() — Scale image proportionally by width. Use in templates with $ScaleWidth.
- StripThumbnail() — Generates a thumbnail for use in the gridfield view
- Thumbnail() — Default thumbnail generation for Images
- ThumbnailIcon() — Thubnail generation for all file types.
- ThumbnailURL() — Get URL to thumbnail of the given size.
- existingOnly() — Return clone of self which promises to only return existing thumbnails
- exists() — Determine if this container has a valid value
- getAbsoluteSize() — Return file size in bytes.
- getAbsoluteURL()
- getAllowGeneration() — Check if resizes are allowed
- getAttributes() — Allows customization through an 'updateAttributes' hook on the base class.
- getFilename() — Get value of filename
- getHash() — Get value of hash
- getHeight() — Get the height of this image.
- getIcon() — Return the relative URL of an icon for the file type, based on the {@link appCategory()} value.
- getImageBackend() — Get Image_Backend instance for this image
- getIsImage() — Determine if a valid non-empty image exists behind this asset
- getMetaData() — Get metadata for this file
- getMimeType() — Get mime type
- getOrientation() — Get the orientation of this image.
- getStream()
- getString()
- getURL()
- getVariant() — Get value of variant
- getWidth() — Get the width of this image.
- initAttributes() — Initialise the attirbutes on this object. Should only be called imiditely after intialising the object.
- isHeight() — Determine if this image is of the specified width
- isSize() — Determine if this image is of the specified size
- isWidth() — Determine if this image is of the specified width
- manipulate() — Generate a new DBFile instance using the given callback if it hasn't been created yet, or return the existing one if it has.
- manipulateImage() — Wrapper for manipulate that passes in and stores Image_Backend objects instead of tuples
- setAllowGeneration() — Set whether image resizes are allowed
- setAttribute() — Add a HTML attribute when rendering this object. This method is immutable, it will return you a copy of the original object.
- setImageBackend()
- updateURL() — Update the url to point to a resampled version if forcing
- variantName() — Name a variant based on a format with arbitrary parameters
- variantParts() — Reverses {@link variantName()}.