getting jpeg error

Posted by bhaskaragr29 on Stack Overflow See other posts from Stack Overflow or by bhaskaragr29
Published on 2010-05-08T05:58:57Z Indexed on 2010/05/08 6:08 UTC
Read the original article Hit count: 244

Filed under:
|
<?php

function LoadPNG()
{
    /* Attempt to open */
    //require_once 'resizex.php';
    $imgname="/home2/puneetbh/public_html/prideofhome/wp-content/uploads/268995481image_11.png";
    //$im = @imagecreatefrompng($imgname);
    $img= imagecreatefromstring(file_get_contents($imgname));
    //$im=imagecreatefrompng('images/frame.png');
    $im= imagecreatefromjpeg('images/frame.jpeg');
    //imagealphablending($img, false);
    //imagesavealpha($img, true);

    //$img=resizex("$url",60,65,1);
    imagecopymerge($im,$img,105,93,0, 0,275,258,100);
    /* See if it failed */
    if(!$im)
    {
        /* Create a blank image */
        $im  = imagecreatetruecolor(150, 30);
        $bgc = imagecolorallocate($im, 255, 255, 255);
        $tc  = imagecolorallocate($im, 0, 0, 0);

        imagefilledrectangle($im, 0, 0, 150, 30, $bgc);

        /* Output an error message */
        imagestring($im, 1, 5, 5, 'Error loading ' . $imgname, $tc);
    }

    return $im;
}
$img = LoadPNG();
header('Content-type: image/jpeg');
imagejpeg($im);
imagedestroy($im);
imagedestroy($img);

?>

i am getting error arning: imagecreatefromjpeg() [function.imagecreatefromjpeg]: gd-jpeg: JPEG library reports unrecoverable error: in /home2/puneetbh/public_html/prideapp/frame.php on line 11

Warning: imagecreatefromjpeg() [function.imagecreatefromjpeg]: 'images/frame.jpeg' is not a valid JPEG file in /home2/puneetbh/public_html/prideapp/frame.php on line 11

Warning: imagecopymerge(): supplied argument is not a valid Image resource in /home2/puneetbh/public_html/prideapp/frame.php on line 16

Warning: Cannot modify header information - headers already sent by (output started at /home2/puneetbh/public_html/prideapp/frame.php:11) in /home2/puneetbh/public_html/prideapp/frame.php on line 34

Warning: imagejpeg(): supplied argument is not a valid Image resource in /home2/puneetbh/public_html/prideapp/frame.php on line 35

Warning: imagedestroy(): supplied argument is not a valid Image resource in /home2/puneetbh/public_html/prideapp/frame.php on line 36

© Stack Overflow or respective owner

Related posts about php

Related posts about gd