Hi,
I got a pretty good code snippet from Zend to grap a
remote image and save it to disk, the problem is, when
it saves to my disk i am unable to open the
images...they are blank and the file matches the
remote images filesize...
Heres the code I got from Zend:
############ Start code ##############
<?php
function GrabImage($url,$filename="") {
if($url==""):return false;endif;
if($filename=="") {
$ext=strrchr($url,".");
if($ext!=".gif" && $ext!=".jpg"):return
false;endif;
$filename=date("dMYHis").$ext;
}
ob_start();
readfile($url);
$img = ob_get_contents();
ob_end_clean();
$size = strlen($img);
[EMAIL PROTECTED]($filename, "a");
fwrite($fp2,$img);
fclose($fp2);
return $filename;
}
$img=GrabImage("URL-TO-IMAGE-COMES-HERE","");
if($img):echo '<pre><img
src="'.$img.'"></pre>';else:echo "No image
there.";endif;
?>
############### End image code ###########
Any idea whats wrong?
Thanks,
Mag
=====
------
- The faulty interface lies between the chair and the keyboard.
- Creativity is great, but plagiarism is faster!
- Smile, everyone loves a moron. :-)
__________________________________
Do you Yahoo!?
Yahoo! Mail Address AutoComplete - You start. We finish.
http://promotions.yahoo.com/new_mail
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php