Q:

Black result image problem on BMP image resize - PHP

I have a php script to re size image file as below;
$file = "test.bmp";
$ext = pathinfo($file, PATHINFO_EXTENSION);
$info = pathinfo($file);
$file_name =  basename($file,'.'.$info['extension']);
$thumbname = "thumb/".$file_name.".".$ext;
$maxh = 200;
$maxw = 200;
$quality = 100;
list($width,$height)=getimagesize($file);

  $src = imagecreatefromwbmp($file);
  $tmp = imagecreatetruecolor($maxw,$maxh);
  imagecopyresampled($tmp,$src,0,0,0,0,200,200,$width,$height);
  imagejpeg($tmp,$thumbname,$quality);
  imagedestroy($tmp);

The script is suppose to resize a windows bitmap image to 200x200 thumbnail. But instead, I am getting a black 200x200 image. I am using php with apache in windows pc. Anybody got a solution or fix?? 
Thanks in advance

A:

.bmp and wbmp are VERY, VERY different file types.
Note the content-type headers:
Content-Type: image/x-xbitmap
Content-Type: image/vnd.wap.wbmp

Calling imagecreatefromwbmp($file) where $file is a .bmp will fail every time.
See this thread for info on how to load a .bmp file.  It's not pretty.

