Jump to content

How can PNGs on Server be converted to JPGs to send to Browser?


Phil262

Recommended Posts

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!

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 !

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.