PHP Web Host - Quality Web Hosting For All PHP Applications Just Great Software
  Login or Register
 • Home • Downloads • Your Account • Forums • 

View next topic
View previous topic


Google
 
Web RavenPHPScripts (This Site)
Post new topic   Reply to topic
Author Message
sixonetonoffun
Spouse Contemplates Divorce


Joined: Jan 02, 2003
Posts: 2499

PostPosted: Fri Dec 10, 2004 12:03 pm Reply with quote Back to top

I know your not still using the infamously buggy My eGallery but if you wanted to with GD thumbnails and your server isn't as old as this addon.
Find in modules/My_eGallery/imageFunctions.php
replace function RatioResizeImgGD() with this one.
Code:

// GD Library
function RatioResizeImgGD($src_file, $dest_file, $newWidth) {
   global
      $gallerypath
   ;
   // find the image size & type
   if(!function_exists('imagecreate')){return $src_file;}

   $imginfo = @getimagesize($src_file);
   switch($imginfo[2]) {
      case 1: $type = IMG_GIF; break;
      case 2: $type = IMG_JPG; break;
      case 3: $type = IMG_PNG; break;
      case 4: $type = IMG_WBMP; break;
      default: return $src_file; break;
   }
   
   switch($type) {
      case IMG_GIF:
         if(!function_exists('imagecreatefromgif')){return $src_file;}
         $srcImage = @imagecreatefromgif("$src_file");
         break;
      case IMG_JPG:
         if(!function_exists('imagecreatefromjpeg')){return $src_file;}
         $srcImage = @ImageCreateFromJpeg($src_file);
         break;
      case IMG_PNG:
         if(!function_exists('imagecreatefrompng')){return $src_file;}
         $srcImage = @imagecreatefrompng("$src_file");
         break;
      case IMG_WBMP:
         if(!function_exists('imagecreatefromwbmp')){return $src_file;}
         $srcImage = @imagecreatefromwbmp("$src_file");
         break;
      default: return $src_file;
   }
   
   if($srcImage){
      // height/width
      $srcWidth = $imginfo[0];
      $srcHeight = $imginfo[1];
      $ratioWidth = $srcWidth/$newWidth;
      $destWidth = $newWidth;
      $destHeight = $srcHeight / $ratioWidth;
      // resize
      $destImage = @imagecreatetruecolor($destWidth, $destHeight);
                if (function_exists("imagecopyresampled")) {
                imagecopyresampled($destImage, $srcImage, 0, 0, 0, 0, $destWidth,(int)$destHeight, $srcWidth, $srcHeight);
                }else{
                  imagecopyresized($destImage, $srcImage, 0, 0, 0, 0, $destWidth,(int)$destHeight, $srcWidth, $srcHeight);
                }
      // create and save final picture
      
      switch($type){
         case IMG_GIF: @imagegif($destImage, "$dest_file", 100); break;
         case IMG_JPG: @imagejpeg($destImage, "$dest_file", 100); break;
         case IMG_PNG: @imagepng($destImage, "$dest_file", 100); break;
         case IMG_WBMP: @imagewbmp($destImage, "$dest_file", 100); break;
      }

      // free the memory
      @imagedestroy($srcImage);
      @imagedestroy($destImage);

      return $dest_file;
   }
   else
   {
      return $src_file;
   }
}
View user's profile Send private message
Display posts from previous:       
Post new topic   Reply to topic

View next topic
View previous topic
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Forums ©
 

All logos and trademarks in this site are property of their respective owner.
The comments are property of their posters, all the rest © 2002-2011 by Raven

You can syndicate our news using the file xml

CSE HTML Validator Helped Clean up This Page! [Valid RSS] valid RSS 2.0 Valid robots.txt Stop Spam Harvesters, Join Project Honey Pot

Website engines core code is © copyright by PHP-Nuke but has been heavily patched and modified by myself and others.
PHP-Nuke is a free software released under the GNU/GPL.


:: fisubice phpbb2 style by Daz :: PHP-Nuke theme by www.nukemods.com ::
:: fisubice Theme Modified by the RavenNuke™ Team ::

:: W3C CSS Compliance Validation :: W3C HTML 4.01 Transitional Compliance Validation ::

zerosum