Generate thumbnail images with Laravel Croppa
weotch released a nice package that we can use to generate thumbnails easily.
Croppa is an thumbnail generator bundle for Laravel 4.x, 5.x and Lumen (local storage only). It follows a different approach from libraries that store your thumbnail dimensions in the model, like Paperclip. Instead, the resizing and cropping instructions come from specially formatted urls. For instance, say you have an image with this path:
/uploads/09/03/screenshot.png
To produce a 300x200 thumbnail of this, you would change the path to:
/uploads/09/03/screenshot-300x200.png
This file, of course, doesn't exist yet. Croppa listens for specifically formatted image routes and build this thumbnail on the fly, outputting the image data (with correct headers) to the browser instead of the 404 response.
Link:
This post is submitted by our members. Submit a new post.
Tags: Tutorials Laravel 5 Laravel 5.1 Laravel 5.2 Laravel 5.3 Intermediate Packages Sources