Forum Moderators: coopster

Message Too Old, No Replies

Unable to create GD image resource from BMP

Can't create a GD image resource from a BMP with MIME type 'image/x-ms-bmp'

         

Sekka

11:06 am on Jan 20, 2010 (gmt 0)

10+ Year Member



Hey,

I'm trying to create a GD image resource from a BMP image, however I'm having no luck.

The BMP image in question was created and saved with Photoshop. I've tried a couple of BMPs I found on the web too, and they gave the same results.

getimagesize() tells me the BMP image has an image type of IMAGETYPE_BMP (6) and a MIME type of 'image/x-ms-bmp'.

I've tried running the image through imagecreatefromwbmp() and imagecreatefromxbm(), but neither recognise it. I've also tried running it through imagecreatefromstring(), but that errored saying 'Data is not in a recognized format'.

I'm running XAMPP on a Windows machine with PHP 5.3.1 and GD 2.0.34 with WBMP and XBM support enabled. I've also tried this on a Linux server running PHP 5.2.6 and GD 2.0.34 with WBMP and XBM support enabled, same result.

Any ideas how I can create a GD image resource from this BMP? Am I missing something obvious?

Thank you.

penders

11:50 pm on Jan 20, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



I've not tried this myself, but... BMP is not the same as WBMP or XBM. And PHP does not appear to have the equivalent imagecreatefrom...() function for BMPs. However, there is much discussion and what looks like a solution to this problem in the comments on the imagecreatefromwbmp() PHP Manual page [uk2.php.net].