Re: Download image in PHP
| From: | Jochem Maas | Date: | Wed, 05 Apr 2006 16:03:08 +0000 |
| Subject: | Re: Download image in PHP | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-233278@lists.php.net to get a copy of this message | ||
Russell Jones wrote:
I have an image library on one site that I want to be able to access from another, but I actually want the image downloaded and cached to the new site (so that it doesnt keep taxing the image server). I allow the file() command to pull from other sites, can I do this with just the file('http://www.site.com/image.jpg"); - or how would i do this?you can if the ini setting 'allow_url_fopen' is set to true (you hosting provider may not allow it - in which case the cURL exntension or the 'wget' trick mentioned by others are alternative solutions). I would recommend using file_get_contents() if you have it (depends on you php version) iso file().
Russ