diff options
author | andi <andi@splitbrain.org> | 2005-04-16 14:00:37 +0200 |
---|---|---|
committer | andi <andi@splitbrain.org> | 2005-04-16 14:00:37 +0200 |
commit | f54a290c82dea42a1006c3e79b9d55455f424381 (patch) | |
tree | 28bf59c68e1ddfd106ed43dbaadbee232ae38362 | |
parent | 97a3e4e3d70217e2c16b0d48f9cd28f52d80368f (diff) | |
download | rpg-f54a290c82dea42a1006c3e79b9d55455f424381.tar.gz rpg-f54a290c82dea42a1006c3e79b9d55455f424381.tar.bz2 |
alphachannel saving for PNG resizing
darcs-hash:20050416120037-9977f-e7c116a8841d4c908e58b1bb034616afa523ac73.gz
-rw-r--r-- | fetch.php | 7 |
1 files changed, 7 insertions, 0 deletions
@@ -172,6 +172,7 @@ function resize_image($ext,$from,$from_w,$from_h,$to,$to_w,$to_h){ }elseif($ext == 'png') { if(!function_exists("imagecreatefrompng")) return false; $image = @imagecreatefrompng($from); + }elseif($ext == 'gif') { if(!function_exists("imagecreatefromgif")) return false; $image = @imagecreatefromgif($from); @@ -184,6 +185,12 @@ function resize_image($ext,$from,$from_w,$from_h,$to,$to_w,$to_h){ if(!$newimg) $newimg = @imagecreate($to_w, $to_h); if(!$newimg) return false; + //keep png alpha channel if possible + if($ext == 'png' && $conf['gdlib']>1 && function_exists('imagesavealpha')){ + imagealphablending($newimg, false); + imagesavealpha($newimg,true); + } + // create cachedir io_makeFileDir($to); |