Recommend this page to a friend! |
Download .zip |
Info | Example | View files (7) | Download .zip | Reputation | Support forum | Blog | Links |
Last Updated | Ratings | Unique User Downloads | Download Rankings | |||||
2023-12-27 (5 months ago) | Not enough user ratings | Total: 128 | All time: 9,376 This week: 78 |
Version | License | PHP version | Categories | |||
nano-image 1.0.2 | GNU General Publi... | 5 | PHP 5, Graphics |
Description | Author | |
This class can resize local or remote images. |
<?php |
NanoImage is a simple php image resize class. It can resize image and display it in browser or save image in a directory
Installation is super-easy via Composer:
composer require peterujah/nano-image
$image = new NanoImage();
try{
$image = $imagine->open("path/to/save/edit-image-size.jpg");
$image->resize(360, 200, false);
$image->save("path/to/save/new-image.jpg", NanoImage::THUMBNAIL, 80);
$image->resize(116, 80, false);
$image->saveAs("path/to/save/new-image.jpeg", NanoImage::THUMBNAIL, 100, NanoImage::JPEG);
$image->free();
}catch(UnsupportedImageException $e){
echo $e->getMessage();
}
$img = new Peterujah\NanoBlock\NanoImage();
Initialize nano image class for use
Open and load any image from a directory path & file name
$img->open(__DIR__ . "/path/to/assets/image.jpg");
Or load string containing the image data.
$img->load($image_data);
Resize image with exact width and height passed, example 200x200. To resize image using aspect ratio set the thrid parameter to true
$img->resize(200, 200, false||true);
Once image manipulation is done display the output image on browser. Pass qaulity of image
$img->display($quality);
Save image to directory, first parameter specify the path, second default is null while quality is 90 by default
$img->save(__DIR__ . "/path/to/assets/new-image.jpg", NanoImage::THUMBNAIL || null, $quality);
Save image as
$img->saveAs($to, NanoImage::THUMBNAIL || NanoImage::TIMESTAMP, $quality, self::JPEG)
Replace existing image with new one
$img->replace($to, $quality)
Remove temp image after editing and free momory
$img->remove()
Free memory
$img->free()
Files |
File | Role | Description | ||
---|---|---|---|---|
src (2 files) | ||||
test (1 file) | ||||
composer.json | Data | Auxiliary data | ||
LICENSE | Lic. | License text | ||
package.json | Data | Auxiliary data | ||
readme.md | Doc. | Documentation |
Files | / | src |
File | Role | Description |
---|---|---|
NanoImage.php | Class | Class source |
UnsupportedImageException.php | Class | Class source |
Version Control | Unique User Downloads | Download Rankings | |||||||||||||||
100% |
|
|
Applications that use this package |
If you know an application of this package, send a message to the author to add a link here.