PHP Classes

PHP Upload Picture: Validate and resize an uploaded image file

Recommend this page to a friend!
     
  Info   View files Files   Install with Composer Install with Composer   Download Download   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
Not enough user ratingsTotal: 890 All time: 3,973 This week: 68Up
Version License PHP version Categories
upload-picture 1.9BSD License5.3PHP 5, Graphics, Files and Folders, V...
Description 

Author

This class can validate and resize an uploaded image file.

It takes an array entry from the $_FILES array for a given uploaded file and checks if it has one of the allowed file name extensions, checks if it as one of the allowed MIME types, and checks if the file size does not exceed the limit size.

Valid picture images may be moved to a given directory with the original name or a given new name.

The class may also rescale the image to fit a given width and height preserving the original picture proportions.

The class may also save the picture in JPEG format with a given compression level.

The class throws exceptions for any validation or processing errors.

Picture of catalin
  Performance   Level  
Name: catalin <contact>
Classes: 6 packages by
Country: Romania Romania
Age: 44
All time rank: 108526 in Romania Romania
Week rank: 258 Up3 in Romania Romania Up

Details

uploadPicture ============= Easy upload for image files. Allow change of file name. Alow change of save path (but this save path must creted before, with correct right). Allow resize and compression. OBS: after resize or compression all files will be saved as jpg/jpeg.

  Files folder image Files (4)  
File Role Description
Accessible without login Plain text file index.php Aux. Example html file for upload
Accessible without login Plain text file README.md Data Short description
Accessible without login Plain text file uploadFile.php Example Example file: how to use
Plain text file UploadPicture.php Class Main class file

The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page.
Install with Composer Install with Composer
 Version Control Unique User Downloads Download Rankings  
 100%
Total:890
This week:0
All time:3,973
This week:68Up