I am creating a script that takes an image from one server, makes it smaller and saves it on another server but I am stuck on how to transfer an image...
I tried this:
PHP Code:
$url_logo = 'http://www.serverA.com/image.jpg';
$url_logo_local = 'smaller_image.jpg';
$fp = fopen($url_logo, "r");
while(!feof($fp)) {
$contents .= fread($fp, 4096);
}
fclose($fp);
$fp = fopen($url_logo_local, "w+");
fwrite($fp, $contents);
fclose($fp);
which works but takes FOREVER (setting the exectution limit to 120 seconds still is not enough, even with small files) so I am hoping that somebody can suggest a better way!
Thanks a lot if you can help!
Bookmarks