Re: [PHP] Download image in PHP

2006-04-05 Thread Jochem Maas

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



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



Re: [PHP] Download image in PHP

2006-04-05 Thread Joe Henry
On Wednesday 05 April 2006 7:16 am, mbneto wrote:
> Hi,
>
> If all you want to do is this as a suggestion (altough not php
> related) you could call wget from your php script to fetch this image
> without having to worry with other things.
>
> Something like this
>
> exec ('/path/to/wget http://www.foo.com/bar.jpg');
>
> Of course you'd have to check if everything went fine.
>
> On 4/5/06, Russell Jones <[EMAIL PROTECTED]> 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?
> >
> > Russ

You might want to look at CURL, too.

http://us2.php.net/manual/en/ref.curl.php
-- 
Joe Henry
www.celebrityaccess.com
[EMAIL PROTECTED]

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



Re: [PHP] Download image in PHP

2006-04-05 Thread mbneto
Hi,

If all you want to do is this as a suggestion (altough not php
related) you could call wget from your php script to fetch this image
without having to worry with other things.

Something like this

exec ('/path/to/wget http://www.foo.com/bar.jpg');

Of course you'd have to check if everything went fine.

On 4/5/06, Russell Jones <[EMAIL PROTECTED]> 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?
>
> Russ
>
>

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



[PHP] Download image in PHP

2006-04-05 Thread Russell Jones
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?

Russ