![]() Image already had lossy compression applied, this leads to the image beingĬompressed twice over which can produce a poor result. Whenever Silverstripe CMS performs a manipulation on an image, it saves the outputĪs a new image file, and applies compression during the process. SilverStripe\Assets\Storage\DBFile : extensions : - ImageExtension Form Upload #įor usage on a website form, see FileField. SilverStripe\Assets\Image : extensions : - ImageExtension $Image.AbsoluteLink // Returns absolute URL path to image $Image.Link // Returns relative URL path to image $Image.FileName // Returns the actual file name including directory path from web root $Image.Name // Returns the actual file name $Image.Title // Returns the friendly file name $Image.Orientation // Returns Orientation $Image.Pad(100, 100, CCCCCC) // Same as above but with a grey background $Image.Pad(100,100) // Returns a 100x100px padded image, with white bars added at the top and bottom Padding functions (add space around an image) $Image.CropHeight(50) // Returns a 200x50px image (trims excess pixels off the y axis from the center) $Image.CropWidth(150) // Returns a 150x100px image (trims excess pixels off the x axis from the center) $Image.FillMax(150,150) // Returns a 100x100px image (like Fill but prevents up-sampling) $Image.Fill(150,150) // Returns a 150x150px image resized and cropped to fill specified dimensions (up-sampled) $Image.ResizedImage(200, 300) // Forces dimensions of this image to the given values. Warning: This method can distort images that are not the correct aspect ratio ![]() $Image.FitMax(300,300) // Returns a 200x100px image (like Fit but prevents up-sampling) $Image.Fit(300,300) // Returns an image that fits within a 300x300px boundary, resulting in a 300x150px image (up-sampled) $Image.ScaleMaxHeight(150) // Returns a 200x100px image (like ScaleHeight but prevents up-sampling) $Image.ScaleHeight(150) // Returns a 300x150px image (up-sampled. $Image.ScaleMaxWidth(100) // Returns a 100x50px image (like ScaleWidth but prevents up-sampling) $Image.ScaleWidth(150) // Returns a 150x75px image Here are some examples, assuming the $Image object has dimensions of 200x100px: Images are preserved (meaning images are not stretched). ![]() Image or clutter the CMS with any additional files, and any images you create You can manipulate images directly from templates to create images that are Into an tag on your website automatically. To the underlying Image records, images are saved as shortcodes. Images can be inserted into HTMLValue database fields Inserting images into the WYSIWYG editor # Images can be uploaded like any other file, through FileField.Īllows upload of images through limiting file extensions with setAllowedExtensions(). Usage # Managing images through form fields # In either case, the same image resizing and manipulation functionality is available though the common Image files can be stored either through the Image dataobject, or though DBFile fields.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |