Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
QUESTION Upload png image
#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


Messages In This Thread
Upload png image - by smdp-1971 - 2017-05-02, 01:31:42
RE: Upload png image - by shawn_a - 2017-05-02, 02:04:11
RE: Upload png image - by shawn_a - 2017-05-02, 03:13:19



Users browsing this thread: 2 Guest(s)