Jump to content

[SOLVED] Creating an image


J4B

Recommended Posts

Alright, I was looking to grab an image off IMDB for my movie site and save it to the server. I found this:

http://www.phpfreaks.com/forums/index.php?topic=165132

 

The only problem is that when I do it, I get a bunch of random characters printed on screen like this:

 

ÿØÿà�JFIF������ÿþ�½k­ó-ÿ�å˜ób·óäþgë_Ëõ~×Ëô?Ö:T¯ó×]?¥ùúô¨üÄ‹þZË×÷}¾ŸËß=/JÓþÐñ~^ütþž½q^_gþ°ÿ�­óyé×·_óëžõéz&©c÷¿òÛù}0?Ë¥xY¯ð—£üÑú7[Ù+ím²¶Òíôù¾Ñgþ»¤àÿ�õ¿ž>q~ç÷™ó?9Ïqùöô¢Úâ7›Ìÿ�Ñütõÿ�z&íòËÓÿ�­

 

The image does work, but is there a way to prevent this from being printed on screen?

This is my code right now:

 

$array1 = explode('images/M/', $image);
$image = $array1[1];
$image = str_replace('" /> " border="0"></body></html>', "", $image);
$image = str_replace('.jpg" />', "", $image);
$imageURL = "http://ia.media-imdb.com/images/M/" . $image;  
$im = imagecreatefromjpeg($imageURL); // Attempt to open



    if (!$im) { // See if it failed //
        exit("nothing happened");
        $im  = imagecreatetruecolor($Width, $Hight); // Create a black image
        $bgc = imagecolorallocate($im, 135, 206, 250);
        $tc  = imagecolorallocate($im, 255, 255, 255);
        imagefilledrectangle($im, 0, 0, $Width, $Hight, $bgc);
        // Output an errmsg //
        imagestring($im, 5, 5, 5, "Error loading Satellite Map", $tc);
    }
imagejpeg($im,$fname,100);
imagedestroy($im);

 

also, it doesn't actually save the image anywhere, how would i make it save in root/covers/image ?

Link to comment
https://forums.phpfreaks.com/topic/150081-solved-creating-an-image/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.