...

View Full Version : Convert a BMP image to a JPEG image with PHP?



Majoracle
01-07-2007, 09:03 PM
I know it's possible, because sites like MySpace and Photobucket do it. I looked through multiple functions related to the process:

imagecreate(), imagejpeg(), imagecreatetruecolor(), and so on, but I can't put it all together.

Anyway, anyone know how it's done or got a lint to a tutorial or something? Thanks.

firepages
01-08-2007, 01:18 AM
Ask your host if they have ImageMagick installed .. I find it far easier to use than GD, example..


<?php
$exec = "convert /path/to/img.bmp /path/to/img.jpg");
exec($exec);
?>


imageMagick also supports more formats than gd, and in the above script the original image could be a tiff,bmp,gif... whatever, the conversion would still work.

crunkbbfe
01-08-2007, 03:21 AM
I used to run a game, and i let people upload their own pictures and what i did to make them all JPEGS was i just named the file for them. I dont think taking a .bmp and renaming it with .jpg will change the picture, it didn't when i used it on a game. I still have game up if you want to see how it works http://crunkboii.byethost8.com/fish/

Majoracle
01-08-2007, 05:09 AM
Ask your host if they have ImageMagick installed .. I find it far easier to use than GD, example..


<?php
$exec = "convert /path/to/img.bmp /path/to/img.jpg");
exec($exec);
?>


imageMagick also supports more formats than gd, and in the above script the original image could be a tiff,bmp,gif... whatever, the conversion would still work.

Fortunately, they did have ImageMagick, and that worked. Thank you!



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum