Created
June 25, 2012 19:40
-
-
Save eduardo-marcolino/2990774 to your computer and use it in GitHub Desktop.
Symfony timthumb generator helper
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Timthumb Helper | |
* Helper para geração de thumbnails com o timthumb | |
* | |
* @see http://www.binarymoon.co.uk/projects/timthumb/ | |
* @author Eduardo Marcolino <eduardo.marcolino@gmail.com> | |
* | |
* @param source $image url to image | |
* @param width $width the width to resize to | |
* @param height $height the height to resize to | |
* @param type $quality 0 - 100 | |
* @param type $alignment c, t, l, r, b, tl, tr, bl, br | |
* @param type $zoom_crop 0, 1, 2, 3 | |
* @return timthumb image | |
*/ | |
function timthumb($image, $width = 0, $height = 0, $quality = 100, $alignment = 'c', $zoom_crop = 0) | |
{ | |
$params = array( | |
'w='.$width, | |
'h='.$height, | |
'q='.$quality, | |
'src='.$image, | |
'a='.$alignment, | |
'zc='.$zoom_crop | |
); | |
return image_tag(_compute_public_path('/timthumb.php','','php',true).'?'.join('&',$params)); | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment