Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
QUESTION Upload png image
#1
When upload image is it possible to get a transparent background PNG image. Now it looks like this (black background)?

Tnx

[img][Image: screen-1.png]jpg imagescertificity.com[/img]
Reply
#2
It is transparent, that's just the background. Use css to turn it off with the admincss plugin
.jcrop-holder{
background-color: #000;
}


oh nm that was fixed in 3.4, still a bug in 3.3x, when saving the thumbnail loses transparency, which is a separate issue.
The image script had to be modified to preserve transparency. Ill see if it can be patched in or not.
NEW: SA Admin Toolbar Plugin | View All My Plugins
- Shawn A aka Tablatronix
Reply
#3
replace and add these functions to admin/inc/imagemanipulation.php

PHP Code:
    /**
     * Private method to run the imagecopyresampled() function with the parameters that have been set up.
     * This method is used by the save() and show() methods.
     */
    
private function createResampledImage()
    {
        
/* change ImageCreateTrueColor to ImageCreate if your GD not supported ImageCreateTrueColor function*/
        
if ( isset($this->image["sizex_thumb"]) && isset($this->image["sizey_thumb"]) ) {        
            
$this->image["des"] = ImageCreateTrueColor($this->image["sizex_thumb"], $this->image["sizey_thumb"]);
            
$this->preserveAlpha();            
            
imagecopyresampled($this->image["des"], $this->image["src"], 00$this->image["targetx"], $this->image["targety"], $this->image["sizex_thumb"], $this->image["sizey_thumb"], $this->image["sizex"], $this->image["sizey"]);
        } else {
            
$this->image["des"] = ImageCreateTrueColor($this->image["sizex"], $this->image["sizey"]);
            
$this->preserveAlpha();            
            
imagecopyresampled($this->image["des"], $this->image["src"], 00$this->image["targetx"], $this->image["targety"], $this->image["sizex"], $this->image["sizey"], $this->image["sizex"], $this->image["sizey"]);
        }    
    }
    
    
/**
     * preserve alpha channel
     * @return boolean true:enable transparency alpha blending
     */
    
private function preserveAlpha($bool=true){
        
imagealphablending($this->image["des"], !$bool);
        
imagesavealpha($this->image["des"], $bool);        
    } 

the preserveAlpha calls being the fix
NEW: SA Admin Toolbar Plugin | View All My Plugins
- Shawn A aka Tablatronix
Reply




Users browsing this thread: 1 Guest(s)