Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

SitePoint PHP Blog:
Glide: Easy Dynamic on-Demand Image Resizing
Mar 03, 2016 @ 16:52:59

On the SitePoint PHP blog editor Bruno Skvorc has posted a tutorial showing you how to use Glide, an image manipulation library that's a part of the League of Extraordinary Packages.

Glide is an image processing library built on top of Intervention. Its purpose is to facilitate on-demand image processing. That’s a fancy way of saying it creates images as they’re requested if they don’t exist.

He gives the example of the need to manipulate the image based on the user's device - like desktop versus mobile clients. He shows how to get the library installed (via Composer) and how to configure it with cache and source directories. He then integrates the library into a "no framework"-based application, passing the missing image request to the "image" controller for handling. However a basic implementation like this leaves it open to exploit. He shows how to restrict the allowed sizes with an allowedWidths data set. He ends the article with a look at image saving and caching with the possibility of writing the resulting file to the local drive (caching) if re-requested later.

tagged: glide image manipulation library theleague ondemand tutorial

Link: http://www.sitepoint.com/easy-dynamic-on-demand-image-resizing-with-glide/


Trending Topics: