Skip to content

Extension for ZendFramework. A Zend_Filter implementation for resizing images.

Notifications You must be signed in to change notification settings

shahidnajam/Zend_Filter_ImageSize

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Zend Framework extension providing filter facitilies for image size.

Most simple example:

<?php
require_once 'Zend/Filter/ImageSize.php';
$filter = new Zend_Filter_ImageSize();
$output = $filter->setHeight(100)
    ->setWidth(200)
    ->filter('./orig.jpg');

header('Content-Type: image/jpeg');
$fh = fopen($output, 'r');
fpassthru($fh);
fclose($fh);
?>

More complex example:
 - Crop the image instead of fit it into the bounding box.
 - Output as JPEG (actually this is the same as above as it is the default)
 - Set a specific output directory (default = ./)
 - Use caching, i.e. override only if source image is newer than thumbnail (if exists)

<?php
require_once 'Zend/Filter/ImageSize.php';
require_once 'Zend/Filter/ImageSize/Strategy/Crop.php';

$filter = new Zend_Filter_ImageSize();
$output = $filter->setHeight(100)
    ->setWidth(200)
    ->setQuality(75)
    ->setOverwriteMode(Zend_Filter_ImageSize::OVERWRITE_ALL)
    ->setThumnailDirectory('./')
    ->setType('jpeg')
    ->setStrategy(new Zend_Filter_Imagesize_Strategy_Crop())
    ->filter('./orig.jpg');

header('Content-Type: image/jpeg');
$fh = fopen($output, 'r');
fpassthru($fh);
fclose($fh);

?>

About

Extension for ZendFramework. A Zend_Filter implementation for resizing images.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published