spescina / timthumb by simonpex

An image proxy for Laravel
5,997
5
1
Package Data
Maintainer Username: simonpex
Maintainer Contact: s.pescina@gmail.com (Simone Pescina)
Package Create Date: 2013-08-08
Package Last Update: 2014-04-12
Language: PHP
License: MIT
Last Refreshed: 2024-12-11 15:23:47
Package Statistics
Total Downloads: 5,997
Monthly Downloads: 8
Daily Downloads: 1
Total Stars: 5
Total Watchers: 1
Total Forks: 2
Total Open Issues: 0

This project is not under development anymore. Check spescina/imgproxy instead

I think that this feature has to be left outside the framework. I don't like that Laravel has to be booted upon each image request.

Timthumb

An image proxy for Laravel

Installation

To install Timthumb as a Composer package to be used with Laravel 4, simply add this to your composer.json:

"spescina/timthumb": "1.0.*"

and run composer update.

Once it's installed, you have to register the service provider. In app/config/app.php add the following line of code to the providers array:

'Spescina\Timthumb\TimthumbServiceProvider'

If you want in app/config/app.php add the following line of code to the alias array

'Timthumb' => 'Spescina\Timthumb\Facades\Timthumb'

Then, publish the config files with php artisan config:publish spescina/timthumb.

Then, publish the asset files with php artisan asset:publish spescina/timthumb.

Usage

Generate the image link with the following line of code

$url = Timthumb::link('path/to/image.jpg',width,height)

Set 0 width or 0 height to let Timthumb mantain the original image ratio