PHP Upload Picture: Validate and resize an uploaded image file

Recommend this page to a friend!
  Info   View files View files (4)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
Not enough user ratingsTotal: 835 All time: 4,107 This week: 254Up
Version License PHP version Categories
upload-picture 1.0BSD 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: 40
All time rank: 109026 in Romania Romania
Week rank: 630 Up7 in Romania Romania Up


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  
File Role Description
Accessible without login Plain text file index.php Aux. Example html file for upload
Accessible without login Plain text file 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

 Version Control Unique User Downloads Download Rankings  
This week:0
All time:4,107
This week:254Up

For more information send a message to info at phpclasses dot org.