Changeset 23445 for branches/version-2_13-dev/data/module/gdthumb.php
- Timestamp:
- 2014/05/26 18:43:18 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/version-2_13-dev/data/module/gdthumb.php
r23444 r23445 228 228 229 229 // png形式 230 case "3": 231 230 case "3": 232 231 $src_im = imageCreateFromPNG($path); 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 232 $colortransparent = imagecolortransparent($src_im); 233 $has_alpha = ord(file_get_contents($path, false, null, 25, 1)) & 0x04; 234 if ($colortransparent > -1 || $has_alpha) { 235 $dst_im = $imagecreate($re_size[0], $re_size[1]); 236 // アルファチャンネルが存在する場合はそちらを使用する 237 if ($has_alpha) { 238 imagealphablending($dst_im, false); 239 imagesavealpha($dst_im, true); 240 } 241 imagepalettecopy($dst_im, $src_im); 242 imagefill($dst_im, 0, 0, $colortransparent); 243 imagecolortransparent($dst_im, $colortransparent); 244 imagecopyresized($dst_im,$src_im, 0, 0, 0, 0, $re_size[0], $re_size[1], $size[0], $size[1]); 245 } else { 246 $dst_im = $imagecreate($re_size[0], $re_size[1]); 247 imagecopyresized($dst_im,$src_im, 0, 0, 0, 0, $re_size[0], $re_size[1], $size[0], $size[1]); 248 249 (imagecolorstotal($src_im) == 0) ? $colortotal = 65536 : $colortotal = imagecolorstotal($src_im); 250 251 imagetruecolortopalette($dst_im, true, $colortotal); 253 252 } 254 253
Note: See TracChangeset
for help on using the changeset viewer.