Home
1 site, unlimited servers No source distribution Non-commercial use only No modifications Read full license | More Info
1 site, unlimited servers No source distribution Non-commercial use only Distribute modifications 1 year support Read full license | More Info
Unlimited projects Source and binary distribution Commercial use allowed Distribute modifications 1 year support Read full license | More Info
Starting from FREE
One of the chalenging that comes with developing and maintaining content management systems (CMS), blogs or forums is to allow to users of the site an easy way to manipulate high quality images throughout the site without any graphical tools.
PHP Imagizer is object-oriented component which developed for those purposes and other use cases. It is well commented and easy-to-use component. Requires GD extension usually compiled in PHP.
With this component you can make transparent text and graphical watermarking, resize and preserve aspect ratio and crop images.
include {PATH_TO_LIBRARY} . 'PhpImagizer.php';
// Source file name
$srcFileName = 'sourceImage.gif';
try {
// Get instance
$imagizer = new PhpImagizer($srcFileName);
// Resize to fit 200px
$imagizer->fitSize(200);
// Save image
$imagizer->saveImg('DestFileName.gif');
} catch (PhpImagizerException $e) {
// Do something (Log, send email?)
}
include {PATH_TO_LIBRARY} . 'PhpImagizer.php';
// Source file name
$srcFileName = 'sourceImage.gif';
try {
// Get instance
$imagizer = new PhpImagizer($srcFileName);
// Crop image
$imagizer->crop(200, 200);
// Save image
$imagizer->saveImg('DestFileName.gif');
} catch (PhpImagizerException $e) {
// Do something (Log, send email?)
}
include {PATH_TO_LIBRARY} . 'PhpImagizer.php';
// Source file name
$srcFileName = 'sourceImage.gif';
// The path to the TrueType font you wish to use
$font = 'arial.ttf';
try {
// Get instance
$imagizer = new PhpImagizer($srcFileName);
// Set shadow, transparency, color and size
$params = array(
'color' => '#FFFFFF',
'transparency' => 70,
'size' => 40,
'font' => $font,
'shadow' => 1 ,
);
// Make watermark at bottom center and save it to DestFileName.gif
$imagizer->watermarkText('www.example.com', PhpImagizer::POSITION_BOTTOM_CENTER, $params);
$imagizer->saveImg('DestFileName.gif');
} catch (PhpImagizerException $e) {
// Do something (Log, send email?)
}
Quite useful, it would be nice to use Zend coding standard, actual do check for GD library existence, not only have a TODO for it. Also functions such as byHeight() don't really reflect what they do.- Cristian Radu, 2 years ago
Starting from FREE
Questions & Comments
Leave a comment
Log-in now or register for a free account.
10 months ago
2 years ago
2 years ago
2 years ago