Re: Remote grabbed images are blank

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Mag wrote:
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...

[snip]

ob_start(); readfile($url); $img = ob_get_contents(); ob_end_clean(); $size = strlen($img);

$fp2=@fopen($filename, "a"); fwrite($fp2,$img); fclose($fp2);

I'm not sure what the problem is, but simplifying the code will help you track it down. Rather than messing with output buffering and fopen/fwrite/fclose, I'd suggest using the copy() function.


This line replaces the 8 lines above:

copy( $url, $filename );

--Rick

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux