Download and install fzerorubigd/silex-lazy-thumbnail-generator without Composer
More information about fzerorubigd/silex-lazy-thumbnail-generator
Files in fzerorubigd/silex-lazy-thumbnail-generator
Shortdescription A lazy thumbnail generator for silex
All versions of silex-lazy-thumbnail-generator with dependenciesVendor: fzerorubigd
Informations about the package silex-lazy-thumbnail-generator
Lazy thumbnail generator for Silex
Create on-demand thumbnail from existing image with image-workshop library
How to use
If you have a directory in your web root, called images, with a lot of images, then you can use this provider to create (and optionally save) the thumbnail from the original images.
for better performance, you can turn off on the fly image processing, then the first time when there is no thumbnail image is available in the target directory, Silex take care of the request, next time, when there is an image there, the web-server (whatever it is) serve the file. (Normally the rewrite is done when the original file is not available)
Array of mounts, each mount need a key here, the key is real folder name in web root with '/' prefix.
is the comma separated allowed extension. defaults are
is array of allowed size in width.height format. for example for allowing the and you should use for any size you can use for example means any request for width 100 is allowed. also there is an optional parameter for maximum allowed size is available, is the .
REMEMBER: its important to prevent access to any size. higher size, means more memory usage and its dangerous.
if you want to use the caching mechanism, then use the and set it to true (default is false) for using this route with UrlGeneratorServiceProvider, you can assign a name to this route with
-- If you want, you can pass route inside the array with key, then the array key is ignored.
Normally the web root is the index.php location, but if not (in case of using php-fpm it could happen) set the full path of web root to this parameter.
Calling the route
This is simple, assuming you have an route (and folder in web root) and there is an image with name in that folder and you are allowed to use jpg image and the size is available, then fetching this route:
show a thumbnail from the original image. if you turn off the on the fly option then the image is created in any new request to this file, is handled by the web server now.
How to contribute?
Pull request are more than welcome, specially on this README :)
The original idea is from this: cgray/nailed