Reply to Problem with resizing multiple files

Problem with resizing multiple files new!
by Amin, 15 years, 11 months ago
hi everybody.

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!');
      }
    }
  }
}
Reply

Your reply

Name *
Email 
Title *
Text *
CAPTCHA image
Enter the code displayed on the image:
Click on the image to generate another one if it is hard to read it. The case is important