| 831 | |
| 832 | if( $type[2] == 3 and function_exists( 'imagealphablending' ) and function_exists( 'imagesavealpha' ) ) { |
| 833 | // Preserve PNG transparency, from http://php.net/manual/en/function.imagecopyresampled.php#44134 |
| 834 | if (function_exists('imageantialias')) |
| 835 | imageantialias($thumbnail, TRUE); // not necessary, but not always available |
| 836 | imagealphablending($thumbnail, false); |
| 837 | imagesavealpha($thumbnail,true); |
| 838 | $transparent = imagecolorallocatealpha($thumbnail, 255, 255, 255, 0); |
| 839 | for($x=0;$x<$image_new_width;$x++) { |
| 840 | for($y=0;$y<$image_new_height;$y++) { |
| 841 | imagesetpixel( $thumbnail, $x, $y, $transparent ); |
| 842 | } |
| 843 | } |
| 844 | } |
| 845 | |