Starting from $ 11.99
An action helper for the Zend Framework for easy resizing of images into file thumbnails or for direct display.
In order to use this action helper you must add the 'Razor' namespace to your application autoloader namespaces. Add the following line it in your application.ini :
autoloaderNamespaces = "Razor_"
In order to automatically load all the helpers inside the directory Razor/Controller/Action/Helper, add the following line to the configuration as well :
resources.frontController.actionHelperPaths.Razor_Controller_Action_Helper = "Razor/Controller/Action/Helper"
Copy the 'Razor' library inside your library folder - your application tree will looks like something like this :
-- application -- configs -- controllers -- models -- views -- library -- Zend -- Razor
The action helper accepts four parameters :
If the second parameter is omitted or empty, the image in rendered directly and not saved on the filesystem.
If you specify both width and height you will get a new image of the specified width and height. If you omit both, the result image is the same width and height of the source. If you specify only width OR only height the dimension not specified is automatically calculated to maintain proportions.
Sample usage #1 - Image is rendered straight to the browser
$imageToMinify = // Your image fullpath $this->_helper->Thumbnail( $imageToMinify );
Sample usage #2 - Image is saved to a destination and height is calculated by the helper
$imageToMinify = // Your image fullpath $destination = // Your resized image destination $width = 640; // width of the new image $this->_helper->Thumbnail( $imageToMinify, $destination, $width );