class.upload.php is a powerful and mature PHP class to manage uploaded files, and manipulate images in many ways. The script is available under a GPL license.
Hi everyone! First of all I would like to thanks Verot and (if they are) all the people that helps this project be that good!
I'm developing a website for a costumer, and I wanted to crop and resize images they upload, and that's how I found class upload.
I'm able to upload correctly the file, rename and move ir to the desire destination. But for some reason I cant apply the images transformation as image_convert, resize or crop (or precrop). I've review all the official doccumentation and some other questions* from the community but I couldn't find what is the problem. Could someone help me? This is the code I'm using:
namespace Verot\Upload;
include('vendor/verot/class.upload.php/src/class.upload.php');
error_reporting(E_ALL);
include("../conn/conn.php");
$v0=0; //valor para enviar estado 0 en driver
$v1=1; //valor para enviar estado 1 en driver
$user_id=$_POST['usr'];
// ---------- IMAGE BIO UPLOAD ----------
$handle = new Upload($_FILES['upload_bio_image']);
$dir_pics="../images/users";
$dir_pics_db="images/users/";
$_width='500';
$_height='500';
$_top='500';
$_right='500';
$_bottom='500';
$_left='500';
if ($handle->uploaded) {
$handle->image_x = $_width;
$handle->image_resize = true;
$handle->jpeg_quality = 80;
$handle->file_overwrite = true;
$handle->file_auto_rename = false;
$handle->image_ratio_crop = true;
$handle->file_new_name_body = $user_id.'-profile';
$handle->image_convert = 'jpg';
$handle->image_precrop = array($_top, $_right, $_bottom, $_left);
$handle->process($dir_pics);
if ($handle->processed) {
// everything was fine !
// header("Location: ../space-profile-2.php?text=img-success");
} else {
// one error occured
/* echo ' File not uploaded to the wanted location';
echo ' Error: ' . $handle->error . '';*/
}
// we delete the temporary files
$handle-> clean();
} else {
// if we're here, the upload file failed for some reasons
// i.e. the server didn't receive the file
/*echo 'File not uploaded on the server';
echo ' Error: ' . $handle->error . '';*/
}
Also I would like to know if I need to get a license to use it. Thanks in advance!
First of all I would like to thanks Verot and (if they are) all the people that helps this project be that good!
I'm developing a website for a costumer, and I wanted to crop and resize images they upload, and that's how I found class upload.
I'm able to upload correctly the file, rename and move ir to the desire destination. But for some reason I cant apply the images transformation as image_convert, resize or crop (or precrop).
I've review all the official doccumentation and some other questions* from the community but I couldn't find what is the problem.
Could someone help me? This is the code I'm using:
Also I would like to know if I need to get a license to use it.
Thanks in advance!
*https://www.verot.net/php_class_upload_forum.htm
*https://github.com/verot/class.upload.php
*https://www.verot.net/php_class_upload_samples.htm?lang=en-GB