Resize a BMP file with PHP and GD

So I recently ran into an issue while trying to resize a BMP file with PHP. Fortunately, I came across this user created function in the imagecreate() section of the PHP website that made it easy as pie.

All you need to do is take the function there and do something like...

PHP:
  1. $src = ImageCreateFromBMP($_FILES['upload_field']['tmp_name']);
  2. imagejpeg($src, 'test.jpg');

Of course that's a pretty bland and simple example, but you should get the point. If not, post a comment and I'd be glad to update it.

BMP Resize with PHP
This entry was posted on Tuesday, March 27th, 2007.
You can leave a comment, or trackback from your own site.

1 Comments

  1. SoLoGHoST, April 17, 2009:

    This doesn’t work. I am trying to resize it down to about 400×400 pixels, this is not working, it just gives me either a black image, or a partial image instead of resizing it.

Leave a comment