Lazy Resizer is a set of php scripts that provides a convenient way of storing resized images. It's not a resizing library, but it can use one.
How it works
Script creates a URL of a resized image. But for that moment it does not know whether a resized image exists or not.
When a resized image would be requested and if it exists, image returns to a browser, otherwise image path rewrites to a php script and resized image will be created.
After resized image was created once, it will never require php script to be executed.
- PHP v5.3.0 or higher
- Apache web server with mod_rewrite (or you can use any similar module for your favorite web server)
- Download this project by issuing a git command
git clone --recursive git://github.com/sanya-gornostal/Lazy-Resizer.gitor visit a download page
resize_handler/config.phpfor your project
LazyResizerclass and implement methods
loadConfig(or just use
resize_handler/PHPThumbResizer.phpalong with PHPThumb library)
resize_handler/resize_handler.phpinclude your class and call a static method
Usage within a website
PHPThumbResizer::resizedPath($original, 50, 100, array('mode' => 'adaptive'))
$originalis a URL to an original image
$heightis an integer. If you specify one of them it will be fine.
- A third optional parameter is an array of parameters that will be added to a returned URL
In this case it returns URL like
Will be glad to get any advice on how to improve the project.