PHP Classes

Nano PHP Image Resize: Resize local or remote images

Recommend this page to a friend!

  Author Author  
Picture of Ujah Chigozie peter
Name: Ujah Chigozie peter <contact>
Classes: 17 packages by
Country: Nigeria Nigeria
Age: 31
All time rank: 240513 in Nigeria Nigeria
Week rank: 38 Up1 in Nigeria Nigeria Up
Innovation award
Innovation award
Nominee: 8x

  Detailed description   Download Download .zip .tar.gz   Install with Composer Install with Composer  
This class can resize local or remote images.

It can take an image's path or URL and create a resized copy of the image in a given local directory.

The class can create resized images that preserve the ratio between the width and height of the original image.


Nano Image

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-imag

Basic Usage

$img = Peterujah\NanoBlock\NanoImage();

Initalize nano image class for use

Open and load image from by passing the directory path & file name

$img->open(__DIR__ . "/path/to/assets/image.jpg");

Or load string containing the 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


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 || null, $quality, self::JPEG)

Replace existing image with new one

$img->replace($to, $quality)

Remove temp image after editing and free momory


Free memory


  Classes of Ujah Chigozie peter  >  Nano PHP Image Resize  >  Download Download .zip .tar.gz  >  Support forum Support forum  >  Blog Blog  >  RSS 1.0 feed RSS 2.0 feed Latest changes  
Name: Nano PHP Image Resize
Base name: nano-image
Description: Resize local or remote images
Version: 1.0.1
PHP version: 5
License: GNU General Public License (GPL)
All time users: 106 users
All time rank: 9563
Week users: 0 users
Week rank: 64 Equal
  Groups   Rate classes User ratings   Applications   Files Files  

Group folder image PHP 5 Classes using PHP 5 specific features View top rated classes
Group folder image Graphics Colors, images, charts and picture formats View top rated classes

  User ratings  
Not yet rated by the users

  Applications that use this package  
No pages of applications that use this class were specified.

Add link image If you know an application of this package, send a message to the author to add a link here.

  Files folder image Files  
File Role Description
Files folder imagesrc (1 file)
Files folder imagetest (1 file)
Accessible without login Plain text file composer.json Data Auxiliary data
Accessible without login Plain text file LICENSE Lic. License text
Accessible without login Plain text file package.json Data Auxiliary data
Accessible without login Plain text file Doc. Documentation

  Files folder image Files  /  src  
File Role Description
  Plain text file NanoImage.php Class Class source

  Files folder image Files  /  test  
File Role Description
  Accessible without login Plain text file upload.php Example Example script

Install with Composer Install with Composer - Download Download all files: nano-image.tar.gz
NOTICE: if you are using a download manager program like 'GetRight', please Login before trying to download this archive.