Storage disks
Generated images are stored on the disk named in disk (default public), inside path. The file name is the MD5 of the request’s query string plus the output extension:
storage/app/public/imagepresets/9787692cc5c74ee279c1ba4cf3b1aa1f.webpIMAGEPRESET_DISK=publicIMAGEPRESET_PATH=imagepresetsLocal disks
Section titled “Local disks”A disk whose driver is local. Glide writes straight into the disk’s root, and the file is served by PHP with response()->file().
The cache root is taken from config('filesystems.disks.<disk>.root'), not from the disk instance — a disk built or re-rooted at runtime (for example Storage::fake() in tests) is not followed.
The files are served through the endpoint, so the disk doesn’t need a public URL.
Keeping the cache out of backups
Section titled “Keeping the cache out of backups”The cache can always be regenerated. To keep it out of backups of storage/app/public, give it its own disk:
'imagepresets' => [ 'driver' => 'local', 'root' => storage_path('app/imagepresets'), 'throw' => false,],IMAGEPRESET_DISK=imagepresetsRemote disks (S3, GCS, FTP, …)
Section titled “Remote disks (S3, GCS, FTP, …)”Any disk whose driver is not local.
IMAGEPRESET_DISK=s3IMAGEPRESET_PATH=imagepresetsOn the first request:
- Glide writes the result into
local_cache_dir(local). - The file is uploaded to the disk.
- The local copy is deleted — only if the upload succeeded.
- The response is streamed from the disk, or redirected (below).
Every following request checks exists() on the disk and, when streaming, reads lastModified() and size() for the headers — a few storage API calls per request. A CDN in front of the endpoint absorbs most of them.
Redirect to a presigned URL
Section titled “Redirect to a presigned URL”By default the file is streamed through PHP. With redirect mode the response is a 302 to temporaryUrl():
IMAGEPRESET_REMOTE_REDIRECT=trueIMAGEPRESET_REMOTE_REDIRECT_TTL=300| Streaming (default) | Redirect | |
|---|---|---|
| Traffic through PHP | Yes | No |
| Storage URL visible to the client | No | Yes, presigned, expires after remote_redirect_ttl |
| Cache headers of the endpoint response | public, max-age=…, immutable | Laravel’s redirect defaults — the redirect itself is not cached by a CDN |
If the driver can’t make temporary URLs (it throws RuntimeException, e.g. FTP or local), the package falls back to streaming. Redirect mode is applied to SVG too.