Esempio n. 1
0
function imagecreatefrombmp($filename)
{
    $tmp_name = tempnam("tmp", "BMP");
    if (bmp2gd($filename, $tmp_name)) {
        $img = imagecreatefromgd($tmp_name);
        unlink($tmp_name);
        return $img;
    }
    return false;
}
Esempio n. 2
0
/**
 *
 * @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;
}
Esempio n. 3
0
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;
}