Welcome Guest, Not a member yet? Register   Sign In
Resizing of transparent/animated gifs [solved]
#15

[eluser]sidhartha[/eluser]
replace the line
Code:
$copy($dst_img, $src_img, 0, 0, $this->x_axis, $this->y_axis, $this->width, $this->height, $this->orig_width, $this->orig_height);

with the following at line number 512 or around it in Image_lib.php. it maintains transparency for both gif and png images. note the imagefilledrectangle() replacing
imagefill(). with imagefill() the transparent part becomes black. but imagefilledrectangle() maintains transparency.
Code:
$proprts         = $this->get_image_properties($this->full_src_path, TRUE);
        $cr_img_type    = $proprts['image_type'];
        //$cr_width        = $proprts['width'];
        //$cr_height        = $proprts['height'];
                    
                    
        if ($cr_img_type == 3)//for png
        {
                        
            imagealphablending( $dst_img, false );
            imagesavealpha( $dst_img, true );
            $transparent_index = imagecolorallocatealpha($dst_img,0,255,0,127);
         //  imagefill($dst_img, 0, 0, $transparent_index);
            imagefilledrectangle($dst_img, 0, 0, $this->width, $this->height, $transparent_index);
            $copy($dst_img, $src_img, 0, 0, $this->x_axis, $this->y_axis, $this->width, $this->height, $this->orig_width, $this->orig_height);
          
        

        }
        
        else if($cr_img_type == 1)//for gif
        
        {
             $transparent_index = imagecolortransparent($src_img);
                  if ($transparent_index >= 0) {
                      imagepalettecopy($src_img, $dst_img);
                    //  imagefill($dst_img, 0, 0, $transparent_index);
                      imagefilledrectangle($dst_img, 0, 0, $this->width, $this->height, $transparent_index);
                      imagecolortransparent($dst_img, $transparent_index);
                      imagetruecolortopalette($dst_img, true, 256);
                  }
                    
            $copy($dst_img, $src_img, 0, 0, $this->x_axis, $this->y_axis, $this->width, $this->height, $this->orig_width, $this->orig_height);
        }
        else//for other
       {
            
        $copy($dst_img, $src_img, 0, 0, $this->x_axis, $this->y_axis, $this->width, $this->height, $this->orig_width, $this->orig_height);    
        
        }


Messages In This Thread
Resizing of transparent/animated gifs [solved] - by El Forum - 10-17-2007, 07:02 AM
Resizing of transparent/animated gifs [solved] - by El Forum - 10-17-2007, 07:15 AM
Resizing of transparent/animated gifs [solved] - by El Forum - 10-17-2007, 07:18 AM
Resizing of transparent/animated gifs [solved] - by El Forum - 10-17-2007, 08:11 AM
Resizing of transparent/animated gifs [solved] - by El Forum - 10-23-2007, 04:55 AM
Resizing of transparent/animated gifs [solved] - by El Forum - 11-15-2007, 04:57 AM
Resizing of transparent/animated gifs [solved] - by El Forum - 04-07-2008, 04:41 PM
Resizing of transparent/animated gifs [solved] - by El Forum - 08-23-2009, 12:09 PM
Resizing of transparent/animated gifs [solved] - by El Forum - 09-15-2009, 05:28 AM
Resizing of transparent/animated gifs [solved] - by El Forum - 09-15-2009, 07:01 AM
Resizing of transparent/animated gifs [solved] - by El Forum - 09-15-2009, 07:21 AM
Resizing of transparent/animated gifs [solved] - by El Forum - 09-19-2009, 07:18 AM
Resizing of transparent/animated gifs [solved] - by El Forum - 04-17-2010, 09:49 AM
Resizing of transparent/animated gifs [solved] - by El Forum - 07-15-2010, 08:41 PM
Resizing of transparent/animated gifs [solved] - by El Forum - 11-25-2010, 05:21 AM
Resizing of transparent/animated gifs [solved] - by El Forum - 12-24-2010, 02:47 AM
Resizing of transparent/animated gifs [solved] - by El Forum - 01-27-2011, 08:44 PM
Resizing of transparent/animated gifs [solved] - by El Forum - 06-08-2011, 10:02 AM
Resizing of transparent/animated gifs [solved] - by El Forum - 07-20-2011, 06:58 AM
Resizing of transparent/animated gifs [solved] - by El Forum - 07-21-2011, 12:54 AM



Theme © iAndrew 2016 - Forum software by © MyBB