PHP Classes
elePHPant
Icontem

Image Saver: Resize an image keeping the size proportions

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Info   View files View files (4)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog    
Last Updated Ratings Unique User Downloads Download Rankings  
2014-05-02 (1 year ago) RSS 2.0 feedNot yet rated by the usersTotal: 631 All time: 4,680 This week: 1,233Up
Version License PHP version Categories  
image-saver 0.0.1MIT/X Consortium ...5PHP 5, Graphics, Files and Folders
Description Author  

This class can resize an image keeping the size proportions.

It can open an uploaded file image in either JPEG, PNG or GIF format and resize it to given width and height.

Either the width and height can be set to auto, so it gets adjusted to keep the original image proportion based on the value set to the other dimension value.

The processed image can be saved to a new file in a given target directory with the JPEG format. The compression quality of the saved image is configurable.

Picture of amir hoseinian
Name: amir hoseinian <contact>
Classes: 2 packages by
Country: Iran Iran
Age: 25
All time rank: 231339 in Iran Iran
Week rank: 1460 Up35 in Iran Iran Up
Innovation award
Innovation award
Nominee: 1x

Winner: 1x

Details provided by the author  
ImageSaver
==========

version 0.0.1  Created by [Amir Hoseinian](https://www.amirhoseinian.com)


Introduction
-----------------

this small class is built for 

- saving post images from html form in file system
- resizing images before saving them


Resizing
--------

- By width    resize(xxx,'auto')
- By height	  resize('auto',xxx)
- By both	  resize(xxx,xxx)

Usage
-----

	<?php

	define('APPLICATION_PATH', __DIR__);

	$imageSaver = new ImageSaver();
	$imageSaver->allowFileTypes = array("jpg","jpeg"); //defining allowed file types

	if(isset($_FILES['image'])){	
		$imageSaver->setImage($_FILES['image'])->setName('test')->setPath("\images\\")->resize('auto',300)->save();
	}

  Files folder image Files  
File Role Description
Files folder imageexamples (1 file, 1 directory)
Plain text file ImageSaver.php Class
Accessible without login Plain text file README.md Doc. Documentation

  Files folder image Files  /  examples  
File Role Description
Files folder imageimages (1 file)
  Accessible without login Plain text file example1.php Example Example script

  Files folder image Files  /  examples  /  images  
File Role Description
  Accessible without login Image file test.jpg Photo Photograph

 Version Control Unique User Downloads Download Rankings  
 100%Total:631All time:4,680
 This week:0This week:1,233Up