GetSimple Support Forum

Full Version: Upload png image
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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]
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.
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