PHP Image Upload Create Thumbnails Class


/ Published in: PHP
Save to your folder(s)

A class for uploading images and creating thumbnails.

Example:
try{
$img = new img('photo');
if($_FILES['photo']['size']>=1000000){
exit('The file size of the file you are trying to upload is over limit.
Your file size = '.$_FILES['photo']['size'].' bytes. File size limit = '.
$this->_limitSize.' bytes. Try again.');
}
$img->setUploadFolder('img/');
$img->setFilename($id);
$img->setDimensions(250,175);
$img->cropToSquare();
$img->upload();
$img->thumb();
$errors = $img->getErrors();
} catch (Exception $e) {
$errors = $e->getMessage();
}

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.