Reply to Joomla - Image resize

Joomla - Image resize new!
by Thomas Dill, 15 years ago
Hallo! Ich habe die class.upload.php in meine Joomla-Komponente eingefügt. Folgendes ist meine Image Klasse:

class Image {
  function saveImage($image,$newName, $path, $image_size, $thumb_size) {
    $newName = str_replace (array("ä", "ö", "ü", "ß", "Ä", "Ö", "Ü", " "),
                            array("ae", "oe", "ue", "ss", "Ae", "Oe", "Ue", "_"),
                            $newName);
    if(substr($path, strlen($path)-1, 1) != DS) $path .= DS;
    if(substr($path, 0, 1) != DS) $path = DS . $path;
    $instance = new Image();
    $handle = new Upload($image);
    if ($handle->uploaded) {
      $handle->file_new_name_body   = $newName;
      $handle->image_resize         = true;
      $handle->image_x              = $image_size;
      $handle->image_ratio_y        = true;
      $handle->Process(JPATH_ROOT . $path);
      if ($handle->processed) {
        echo 'SUCCESS';
          $fileNames['image']       = $handle->file_dst_pathname;
        } else {
          echo 'error : ' . $handle->error;
        }
        //$handle->image_resize            = true;
        //$handle->image_ratio_y           = true;
        //$handle->image_x                 = $thumb_size;
        $handle->file_new_name_body      = $newName.'_small';
        $handle->Process(JPATH_ROOT . $path);
        if ($handle->processed) {
          echo 'SUCCESS';
          $fileNames['image_small']        = $handle->file_dst_pathname;
          $handle->Clean();
        } else {
          echo 'error : ' . $handle->error;
        }
      return $fileNames;
      }
    echo "ERROR";
    return null;
  }
}

Das Problem ist, dass es, sobald ich ein resize versuche zu machen, abbricht. Wenn ich nur ein Rename mache, funktioniert es. Kann mir jemand helfen?

Freundliche Grüsse
TomReply

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