title: PHP: Converting png's and gif's into grayscale
body: <p>im using the following script to convert jpgs into grayscale-images.
  <a href="http://bubble.ro/How_to_convert_an_image_to_grayscale_using_PHP.html" rel="nofollow noreferrer">http://bubble.ro/How_to_convert_an_image_to_grayscale_using_PHP.html</a></p>
  
  <p>i want to upgrade it to also convert pngs (with transparency) and gifs (with transparency) into grayscale images.</p>
  
  <p>At the moment it's not working. I'm querying the image-src for its file-extension. If jpg, if, gif, or if png i call the appropriate imagecreatefrom-jpg-gif-png </p>
  
  <p>However i'm always running the same for-loop and gifs unfortunately only get gray rectangles, every pixel is gray. Png's almost work, however transprency in pngs gets transformed to black.</p>
  
  <p>Any ideas?  </p>