ImageStorage

Downloading ImageStorage

ImageStorage is available through composer package ublaboo/image-storage:

composer require ublaboo/image-storage

The abilities are:

Once the ImageStorage served and altered image, it will be used for all other requests for that specific altered file (works like cache).

Storing

You are saving files within particular namespaces (eg 'avatars'). For better filesystem optimization, target files are saved in <namespace>/<hash>/<file.ext>, where the hash is made from first 2 characters of sha1 hash (or some other configured hashing algorithm) of target file. Therefore there won't be thousands of files in one directory, but files will be distributed under that hash-named directories.

How to save an upload...

Transformation

You simply pass a size parameter to either Latte macro or Latte n:macro or directly ImageStorage. Or crop measures or quality or transformation flag. Or some of these combined. You can also combine the transformation flags with + sign.

How to transform an image...

Deleting

Once you want to delete an image, you should delete all other transformed images made from the original one.

See how to delete an image...

Friendly URL

The transformed image name does not look to much friendly (eg /avatars/kitty.200x200.fit.jpg). You can change the method of creating links to images in configuration file so the link will look /avatars/200x200.fit/kitty.jpg which is much more friendly when downloading the image.

See more...

Tento web používá k poskytování služeb a analýze návštěvnosti soubory cookie. Používáním tohoto webu s tím souhlasíte. V pořádku Další informace