Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    Regular Coder
    Join Date
    Nov 2006
    Posts
    247
    Thanks
    13
    Thanked 26 Times in 24 Posts

    Convert a BMP image to a JPEG image with PHP?

    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.
    Last edited by Majoracle; 01-07-2007 at 09:06 PM.

  • #2
    Super Moderator
    Join Date
    May 2002
    Location
    Perth Australia
    Posts
    4,073
    Thanks
    11
    Thanked 98 Times in 96 Posts
    Ask your host if they have ImageMagick installed .. I find it far easier to use than GD, example..
    PHP Code:
    <?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.
    resistance is...

    MVC is the current buzz in web application architectures. It comes from event-driven desktop application design and doesn't fit into web application design very well. But luckily nobody really knows what MVC means, so we can call our presentation layer separation mechanism MVC and move on. (Rasmus Lerdorf)

  • #3
    New Coder
    Join Date
    Jan 2006
    Location
    California. USA
    Posts
    86
    Thanks
    1
    Thanked 0 Times in 0 Posts
    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/

  • #4
    Regular Coder
    Join Date
    Nov 2006
    Posts
    247
    Thanks
    13
    Thanked 26 Times in 24 Posts
    Quote Originally Posted by firepages View Post
    Ask your host if they have ImageMagick installed .. I find it far easier to use than GD, example..
    PHP Code:
    <?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!


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •