Voting

: max(two, eight)?
(Example: nine)

The Note You're Voting On

George Edison
12 years ago
Creating a new true-color image, filling it with a transparent color, and saving it as a PNG image can be accomplished with the following:

<?php

$new
= imagecreatetruecolor(320, 320);
$color = imagecolorallocatealpha($new, 0, 0, 0, 127);
imagefill($new, 0, 0, $color);
imagesavealpha($new, TRUE); // it took me a good 10 minutes to figure this part out
imagepng($new);

?>

The image needs to be created with imagecreatetruecolor(), you must use imagefill() instead of imagefilledrectange(), and you need to call imagesavealpha(). No other combination of functions calls seems to produce the intended results.

<< Back to user notes page

To Top