Instructions for use

This plugin for Symfony (tested on 1.4v) is built on http://phpthumb.gxdlabs.com/.

Basic



	$thumb = sfPhpThumbFactory::create($file, $options);	
	$thumb -> width = $width;
	$thumb -> height = $height;
	$thumb -> resize($width, $height);
	
	or 
	
	$thumb -> adaptiveResize($width, $height);
	
	$thumb -> getUrl();
	 
    

...but....in this way every time you resize an image you spend time resource for the operation.

Cached image

If you'll use the helper the image will be put in a cache folder and only first time you call the image it will be resized. Next time you will get the image cached.



/**
 * @var $file string path of file  
 * @var $adaptive boolean
 * @var  $optionsPhpThumb array options PhpThumb lib
 * @return string url
 */
	
  retrive_phpthumb_url($file,$width,$height,$adaptive,$optionsPhpThumb );
  
  /**
 * @var $file string path of file  
 * @var $adaptive boolean
 * @var  $options attribute tags
 * @return html anchor
 */

  retrive_phpthumb_tag($file,$width,$height,$adaptive,$options)
    

un example of cached image


	/uploads/cache/0/c/filename_80x100_c.jpg     

Configuration


	#app.yml
	all:
	  sfphpthumbplugin_cache_path: cache/
	  base_id: %SF_UPLOAD_DIR%
	  no_image: %SF_UPLOAD_DIR%/no-image.jpg

phpthumb