J4B Posted March 19, 2009 Share Posted March 19, 2009 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 More sharing options...
J4B Posted March 19, 2009 Author Share Posted March 19, 2009 *bumb* Link to comment https://forums.phpfreaks.com/topic/150081-solved-creating-an-image/#findComment-788245 Share on other sites More sharing options...
J4B Posted March 19, 2009 Author Share Posted March 19, 2009 *bump* Link to comment https://forums.phpfreaks.com/topic/150081-solved-creating-an-image/#findComment-788749 Share on other sites More sharing options...
MadTechie Posted March 19, 2009 Share Posted March 19, 2009 Set $fname ie $fname = "myimage.jpg"; Link to comment https://forums.phpfreaks.com/topic/150081-solved-creating-an-image/#findComment-788752 Share on other sites More sharing options...
J4B Posted March 19, 2009 Author Share Posted March 19, 2009 ahh thanks. Link to comment https://forums.phpfreaks.com/topic/150081-solved-creating-an-image/#findComment-788762 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.