Seite 1 von 1

Bilder hochladen

Verfasst: 26.02.2005 10:36
von Huchi
Hi........,

hab mir jetzt von Smartor den album mod 2.0.53 installiert und hat auch alles so weit geklappt!
Gibt es eine Mögichkeit das Bilder die beim hochladen zu groß sind automatisch auf zugelassene Größe hochgeladen werden. Ich hoffe ihr versteht was ich meine!

Verfasst: 28.02.2005 21:42
von Huchi
*schieb*

Verfasst: 02.03.2005 14:20
von Marc0083
probier mal den hier


öffne album_upload.php

finde

Code: Alles auswählen

   if( ($filesize == 0) or ($filesize > $album_config['max_file_size']) ) 
   { 
      message_die(GENERAL_MESSAGE, $lang['Bad_upload_file_size']); 
   } 
ersetze

Code: Alles auswählen

if( ($filesize == 0) or ($filesize > 1024000) ) 
   { 
      message_die(GENERAL_MESSAGE, $lang['Bad_upload_file_size']); 
   } 
   $recompress = 0; 
   if ($filesize > $album_config['max_file_size']) 
   { 
      $recompress = 1; 
   } 

finde

Code: Alles auswählen

if ( ($pic_width > $album_config['max_width']) or ($pic_height > $album_config['max_height']) ) 
   { 
      @unlink(ALBUM_UPLOAD_PATH . $pic_filename); 

      if ($album_config['gd_version'] == 0) 
      { 
         @unlink(ALBUM_CACHE_PATH . $pic_thumbnail); 
      } 

      message_die(GENERAL_ERROR, $lang['Upload_image_size_too_big']); 
   } 


ersetze mit

Code: Alles auswählen


   if ( (($pic_width > $album_config['max_width']) or ($pic_height > $album_config['max_height'])) OR ($recompress == 1) ) 
   { 
      if ($album_config['gd_version'] == 0) 
      { 
         @unlink(ALBUM_UPLOAD_PATH . $pic_filename); 
         @unlink(ALBUM_CACHE_PATH . $pic_thumbnail); 
         message_die(GENERAL_ERROR, $lang['Upload_image_size_too_big']." Error code: 001"); 
      } 
      $gd_errored = FALSE; 
          

         switch ($pic_filetype) 
         { 
            case '.jpg': 
               $read_function = 'imagecreatefromjpeg'; 
               break; 
            case '.png': 
               $read_function = 'imagecreatefrompng'; 
               break; 
         } 

         $src = @$read_function(ALBUM_UPLOAD_PATH  . $pic_filename); 

         if (!$src) 
         { 
            $gd_errored = TRUE; 
            $pic_thumbnail = ''; 
         } 

         if (($pic_width > $album_config['max_width']) or ($pic_height > $album_config['max_height'])) 
         { 
            if ($pic_width > $pic_height) 
            { 
               $new_width = $album_config['max_width']; 
               $new_height = $album_config['max_width'] * ($pic_height/$pic_width); 
            } 
            else 
            { 
               $new_height = $album_config['max_height']; 
               $new_width = $album_config['max_height'] * ($pic_width/$pic_height); 
            } 
         } 
         else 
         { 
            $new_width = $pic_width; 
            $new_height = $pic_height; 

         } 
         $new_pic = ($album_config['gd_version'] == 1) ? @imagecreate($new_width, $new_height) : @imagecreatetruecolor($new_width, $new_height); 

         $resize_function = ($album_config['gd_version'] == 1) ? 'imagecopyresized' : 'imagecopyresampled'; 

         @$resize_function($new_pic, $src, 0, 0, 0, 0, $new_width, $new_height, $pic_width, $pic_height); 
       
       
      if (!$gd_errored) 
      { 
         // print $recompress ."<br>".$pic_filename; exit; 
         // overwrite old image 
         @unlink(ALBUM_UPLOAD_PATH . $pic_filename); 
          
         switch ($pic_filetype) 
         { 
            case '.jpg': 
               @imagejpeg($new_pic, ALBUM_UPLOAD_PATH . $pic_filename, 80); 
               break; 
            case '.png': 
               @imagepng($new_pic, ALBUM_UPLOAD_PATH . $pic_filename); 
               break; 
         } 
          
         @chmod(ALBUM_CACHE_PATH . $pic_thumbnail, 0777); 
         $pic_width = $new_width; 
         $pic_height = $new_height; 
      } // End IF $gd_errored 
      else 
      { 
         @unlink(ALBUM_UPLOAD_PATH . $pic_filename); 

         if ($album_config['gd_version'] == 0) 
         { 
            @unlink(ALBUM_CACHE_PATH . $pic_thumbnail); 
         } 

         message_die(GENERAL_ERROR, $lang['Upload_image_size_too_big']." Error code: 002"); 
      } 
   } 


offne lang_main_album

und vor ?> einsetzen

Code: Alles auswählen

$lang['Max_file_size'] = 'Maximum file size before recompression (bytes)'; 
$lang['Max_width'] = 'Maximum image width before recompression (pixel)'; 
$lang['Max_height'] = 'Maximum image height before recompression  (pixel)';