function imagecreatefrombmp($filename) { $tmp_name = tempnam("tmp", "BMP"); if (bmp2gd($filename, $tmp_name)) { $img = imagecreatefromgd($tmp_name); unlink($tmp_name); return $img; } return false; }
/** * * @ceate a BMP image * * @param string $filename * * @return bin string on success * * @return bool false on failure * */ function ImageCreateFromBmp($filename) { /*** create a temp file ***/ $tmp_name = tempnam("/tmp", "GD"); /*** convert to gd ***/ if (bmp2gd($filename, $tmp_name)) { /*** create new image ***/ $img = imagecreatefromgd($tmp_name); /*** remove temp file ***/ unlink($tmp_name); /*** return the image ***/ return $img; } return false; }
function bmp2jpg($imgPath) { $tmpPath = tempnam(SAE_TMP_PATH, "img"); if (bmp2gd($imgPath, $tmpPath)) { $img = imagecreatefromgd($tmpPath); imagejpeg($img, $imgPath); unlink($tmpPath); return true; } return false; }