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.
I've got a simple upload with a HTML input file. That's one works fine.
But now I'm using the class with FancyUpload Ajax script. And the upload is good, the file is well uploaded and renamed but there is no resizing or watermarking. Do you know why ?
There is my code:
$handle = new upload($_FILES['photoupload']);
if ($handle->uploaded) {
// $handle->file_new_name_body = $_FILES['img']['name'];
if ( !is_dir(BASE_PATH."www/images/billets/".date("Y-m")."/")) {
mkdir(BASE_PATH."www/images/billets/".date("Y-m")."/");
chmod(BASE_PATH."www/images/billets/".date("Y-m")."/", 0777);
}
// Génération de la miniature 100px largeur
$handle->jpeg_quality = 80;
$handle->image_resize = true;
$handle->image_x = 100;
$handle->image_ratio_y = true;
$handle->file_name_body_add = "_mini";
$handle->file_overwrite = true;
$handle->Process(BASE_PATH."www/images/billets/".date("Y-m")."/");
if ($handle->processed) {
$mini = $handle->file_dst_name;
}
// Génération de l'image pour insertion dans billet: 500px largeur
$handle->jpeg_quality = 80;
$handle->image_resize = true;
$handle->image_x = 500;
$handle->file_name_body_add = "_billet";
$handle->image_watermark = BASE_PATH."www/images/design/watermark/logo-50px.png";
$handle->image_watermark_position = 'BR';
$handle->image_ratio_y = true;
$handle->file_overwrite = true;
$handle->Process(BASE_PATH."www/images/billets/".date("Y-m")."/");
if ($handle->processed) {
$handle->clean();
$result['result'] = 'success';
$result['size'] = utf8_encode("Transféré: ".$handle->file_dst_name." et ".$mini." dans le repértoire ".str_replace(BASE_PATH."www/", "/",$handle->file_dst_path));
} else {
$handle->clean();
$result['result'] = 'failed';
$result['error'] = $handle->error;
}
}
I'm using this class which is awesome !
I've got a simple upload with a HTML input file.
That's one works fine.
But now I'm using the class with FancyUpload Ajax script.
And the upload is good, the file is well uploaded and renamed but there is no resizing or watermarking. Do you know why ?
There is my code:
Thanks for your help.