Reading a file from a model
https://example.com/uploads/articles/image/my-photo.jpg.
A
multiple file field returns a collection of file objects.
Resizing images
resize($width, $height) takes the width as its first argument and the height as its second. With both defined, the image is cropped to the exact size. With only one defined, the other is calculated from the ratio.
resize() returns a new file object pointing to the resized image. SVG files are returned unchanged.
The image is resized on the first request and stored in a cache for later requests.
Advanced image operations
The file object uses Intervention Image, so it can perform any operation that library supports. Theimage($mutators) method takes an array whose keys are the function names and whose values are the arguments of those functions.
fit and then blurs it with blur.
Helper methods
delete
Removes the file from the storage and returnstrue, or false when the file does not exist. The column value is not changed.
download
Returns a signed URL which downloads the file. It works for private files too.filesize
Returns the size in bytes. Passtrue for a formatted size.