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.
My image upload works, the images will upload in 2 folders, but the resize don't work's fine. The first uploaded image will have a width of 200px, the second image will have a width of 800. This is my code:
$handle = new Upload($_FILES['Filedata']);
if ($handle->uploaded) {
$handle->image_resize = true;
$handle->image_x = 200;
$handle->image_ratio_no_zoom_in = true;
$handle->file_new_name_body = $_GET['nieuwsid'];
$handle->Process($targetPath."klein/");
// we now process the image a second time, with some other settings
$handle->image_resize = true;
$handle->image_x = 800;
$handle->image_ratio_no_zoom_in = true;
$handle->file_new_name_body = $_GET['nieuwsid'];
$handle->Process($targetPath."groot/");
// we check if everything went OK
if ($handle->processed) {
echo '1';
}
$handle-> Clean();
}
But, my images are 100 and 150 or so pixels. When the image width is larger then 200 and/or 800, the image(s) must be resized, other the size must be original size.
$handle = new Upload($_FILES['Filedata']); if ($handle->uploaded) { $handle->image_resize = true; $handle->image_x = 200; $handle->image_ratio_no_zoom_in = true; $handle->file_new_name_body = $_GET['nieuwsid']; $handle->Process($targetPath."klein/"); // we now process the image a second time, with some other settings $handle->image_resize = true; $handle->image_x = 800; $handle->image_ratio_no_zoom_in = true; $handle->file_new_name_body = $_GET['nieuwsid']; $handle->Process($targetPath."groot/"); // we check if everything went OK if ($handle->processed) { echo '1'; } $handle-> Clean(); }But, my images are 100 and 150 or so pixels. When the image width is larger then 200 and/or 800, the image(s) must be resized, other the size must be original size.
How can I do this?