Phil262 Posted March 9, 2007 Share Posted March 9, 2007 I need to send images to a Web Browser that can only display JPG, BMP, or GIF images (not PNG). However, all the images are stored on the PHP server in PNG format. I have a command line program (ConvertPngToJpg.exe) that will convert an image from PNG to JPG format. I would like the PHP server to execute ConvertPngToJpg.exe when I see an <IMG SRC="picture.png"> tag to convert the picture.png file to picture.jpg and then also send back to the browser a <IMG SRC="picture.jpg"> tag. Is this possible? Any high level hints on where to start would be appreciated. Ideally I only want to do this on a certain Web Browser (Windows CE version IE 5.5). The header for it is "User-Agent: Mozilla/4.0 (compatible; MSIE 5.5; Windows CE)". Would this also be possible with PHP? TIA! Link to comment https://forums.phpfreaks.com/topic/41978-how-can-pngs-on-server-be-converted-to-jpgs-to-send-to-browser/ Share on other sites More sharing options...
redarrow Posted March 9, 2007 Share Posted March 9, 2007 Do some magic ok http://www.imagemagick.org/script/index.php Link to comment https://forums.phpfreaks.com/topic/41978-how-can-pngs-on-server-be-converted-to-jpgs-to-send-to-browser/#findComment-203531 Share on other sites More sharing options...
Phil262 Posted March 9, 2007 Author Share Posted March 9, 2007 Thanks for the link on ImageMagick. Looks like it will be perfect for the conversion of PNG images to JPG images. As you can tell, I am a newbie, please excuse the very simple question. Now, will it be easy to convert the <IMG SRC="picture.png"> tag to a <IMG SRC="picture.jpg"> tag so I can serve up the picture.jpg file? Also, will it be possible to do this conversion only when connected to a certain browser as indicated in the header: "User-Agent: Mozilla/4.0 (compatible; MSIE 5.5; Windows CE)". TIA again ! Link to comment https://forums.phpfreaks.com/topic/41978-how-can-pngs-on-server-be-converted-to-jpgs-to-send-to-browser/#findComment-203565 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.