GetSimple Support Forum
QUESTION Upload png image - Printable Version

+- GetSimple Support Forum (http://get-simple.info/forums)
+-- Forum: GetSimple (http://get-simple.info/forums/forumdisplay.php?fid=3)
+--- Forum: General Questions and Problems (http://get-simple.info/forums/forumdisplay.php?fid=16)
+--- Thread: QUESTION Upload png image (/showthread.php?tid=9607)



Upload png image - smdp-1971 - 2017-05-02

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]


RE: Upload png image - shawn_a - 2017-05-02

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.


RE: Upload png image - shawn_a - 2017-05-02

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