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 have a problem with resizing multiple files, i want to upload multiple files, then resize them, but when i run my code, it crashes on processing image, and there is no error! but i found the problem, the problem is setting for resize and crop, but what could i do for resizing multiple files? this is my code:
if ( isset($_POST['submit']) ) {
$files = array();
foreach ($_FILES['my_field'] as $k => $l) {
foreach ($l as $i => $v) {
if (!array_key_exists($i, $files))
$files[$i] = array();
$files[$i][$k] = $v;
}
}
foreach ($files as $file) {
$handle = new Upload($file);
if ($handle->uploaded) {
$handle->image_resize = true;
$handle->image_ratio_crop = true;
$handle->image_x = 100;
$handle->image_y = 200;
$handle->Process('./thumb/');
if ($handle->processed) {
echo('ok');
} else {
echo('Thumb Error!');
}
}
}
}
i have a problem with resizing multiple files, i want to upload multiple files, then resize them, but when i run my code, it crashes on processing image, and there is no error! but i found the problem, the problem is setting for resize and crop, but what could i do for resizing multiple files? this is my code: