GD headers for gif, png

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
anjanesh
DevNet Resident
Posts: 1679
Joined: Sat Dec 06, 2003 9:52 pm
Location: Mumbai, India

GD headers for gif, png

Post by anjanesh »

Hi
I have this in code :

Code: Select all

<?php
switch(strtolower(strrchr($_GET['filename'],".")))
 {
    case ".gif":header("Content-type: image/gif");break;
    case ".jpg":case".jpeg":header("Content-type: image/jpeg");break;
    case ".png":header("Content-type: image/png");break;
 }
.
.
.
.
?>
But only jpeg images are being displayed. Howz that ?
Thanks
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

some browsers look for image/x-png IIRC.. as for gif, google says image/gif is correct..
User avatar
anjanesh
DevNet Resident
Posts: 1679
Joined: Sat Dec 06, 2003 9:52 pm
Location: Mumbai, India

Post by anjanesh »

For gif support according to php manual - Only supported in GD versions older than gd-1.6. Read-only GIF support is available with PHP 4.3.0 and the bundled GD-library.

PHP 5 has full gif support but the server has php 4.3.6 and I need to write gif files too since gif supports the transparency.

So now how do I get this working ? Any ideas ?
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

roll your own writer.
Post Reply