Witam, korzystam z class upload i mam następujący problem. Zdjęcia są zapisywana ale nie w trzech różnych rozmiarach a tylko jednym i tym samym;/ wydaje mi się że wszsytko jest prawidłowo zapisane a jednak nie działa.
Bardzo proszę o pomoc.
  1. <?php
  2.  
  3. // we first include the upload class, as we will need it here to deal with the uploaded file
  4. include('class.upload.php');
  5.  
  6. // we have three forms on the test page, so we redirect accordingly
  7. if (!array_key_exists('action', $_POST) || $_POST['action'] == 'simple') {
  8.  
  9.  
  10.  
  11.    // ---------- IMAGE UPLOAD ----------
  12.    
  13.    // we create an instance of the class, giving as argument the PHP object
  14.    // corresponding to the file field from the form
  15.    // All the uploads are accessible from the PHP object $_FILES
  16.    $handle = new Upload($_FILES['my_field']);
  17.  
  18.    // then we check if the file has been uploaded properly
  19.    // in its *temporary* location in the server (often, it is /tmp)
  20.    if ($handle->uploaded) {
  21.      
  22.        // yes, the file is on the server
  23.        // below are some example settings which can be used if the uploaded file is an image.
  24.  
  25.        $handle->image_ratio_y           = true;
  26.        $handle->image_x                 = true;
  27.        $handle->file_overwrite          = true;
  28.        $handle->image_convert           = 'jpg';
  29.        $handle->file_new_name_body      = "$id";
  30.  
  31.        // now, we start the upload 'process'. That is, to copy the uploaded file
  32.        // from its temporary location to the wanted location
  33.        // It could be something like $handle->Process('/home/www/my_uploads/');
  34.        $handle->Process('../../photos/normal/');
  35.        $handle->Process('../../admin/panel/test/');
  36.        
  37.        $handle->image_resize            = true;
  38.        $handle->image_ratio_y           = true;
  39.        $handle->image_x                 = 80;
  40.        $handle->file_overwrite          = true;
  41.        $handle->image_convert           = 'jpg';
  42.        $handle->file_new_name_body      = "$id";
  43.  
  44.        // now, we start the upload 'process'. That is, to copy the uploaded file
  45.        // from its temporary location to the wanted location
  46.        // It could be something like $handle->Process('/home/www/my_uploads/');
  47.        $handle->Process('../../photos/thumb/');
  48.        $handle->Process('../../admin/panel/test2/');
  49.        // we check if everything went OK
  50.        if ($handle->processed) {
  51.            // everything was fine !
  52.           // echo '<fieldset>';
  53.            //echo '  <legend>file uploaded with success</legend>';
  54.            //echo '  <img src="../admin/panel/test2/' . $handle->file_dst_name . '" />';
  55.            $info = getimagesize($handle->file_dst_pathname);
  56.            //echo '  <p>' . $info['mime'] . '  -  ' . $info[0] . ' x ' . $info[1] .'  -  ' . round(filesize($handle->file_dst_pathname)/256)/4 . 'KB</p>';
  57.            //echo '  link to the file just uploaded: <a href="../../admin/panel/test2/' . $handle->file_dst_name . '">' . $handle->file_dst_name . '</a><br/>';
  58.            //echo '</fieldset>';
  59.        } else {
  60.            // one error occured
  61.            //echo '<fieldset>';
  62.            //echo '  <legend>file not uploaded to the wanted location</legend>';
  63.            echo '  Error: ' . $handle->error . '';
  64.            //echo '</fieldset>';
  65.        }
  66.  
  67.        // we now process the image a second time, with some other settings
  68.        $handle->image_resize            = true;
  69.        $handle->image_ratio_y           = true;
  70.        $handle->image_x                 = 150;
  71.        $handle->image_reflection_height = '25%';
  72.        $handle->image_contrast          = 50;
  73.        $handle->file_overwrite          = true;
  74.        $handle->image_convert           = 'jpg';
  75.        $handle->file_new_name_body      = "$id";
  76.  
  77.        $handle->Process('../../photos/thumbbig/');
  78.        $handle->Process('../../admin/panel/zdjecia/');
  79.        // we check if everything went OK
  80.        if ($handle->processed) {
  81.            // everything was fine !
  82.           // echo '<fieldset>';
  83.           // echo '  <legend>file uploaded with success</legend>';
  84.            //echo '  <img src="../../admin/panel/test2/' . $handle->file_dst_name . '" />';
  85.            $info = getimagesize($handle->file_dst_pathname);
  86.            //echo '  <p>' . $info['mime'] . '  -  ' . $info[0] . ' x ' . $info[1] .'  -  ' . round(filesize($handle->file_dst_pathname)/256)/4 . 'KB</p>';
  87.            //echo '  link to the file just uploaded: <a href="test/' . $handle->file_dst_name . '">' . $handle->file_dst_name . '</a><br/>';
  88.           // echo '</fieldset>';
  89.        } else {
  90.            // one error occured
  91.            //echo '<fieldset>';
  92.            //echo '  <legend>file not uploaded to the wanted location</legend>';
  93.            echo '  Error: ' . $handle->error . '';
  94.           // echo '</fieldset>';
  95.        }
  96.  
  97.        // we delete the temporary files
  98.        $handle-> Clean();
  99.  
  100.    } else {
  101.        // if we're here, the upload file failed for some reasons
  102.        // i.e. the server didn't receive the file
  103.       // echo '<fieldset>';
  104.        //echo '  <legend>file not uploaded on the server</legend>';
  105.        echo '  Error: ' . $handle->error . '';
  106.       // echo '</fieldset>';
  107.    }}
  108. ?>