tags:

views:

28

answers:

1

I am developing a website and the images from the websites should come from different server. It is good point that the images are in the different server but the server were the images are coming is too slow. Is there a way that I can cache the images coming from different server to my site. specially creating a physical images in my server in form of cache? Is PHP cache lite capable of doing that?

+1  A: 

You seems to be looking to make a proxy, If I were you I won't do that with PHP or at least not only with PHP. Just install and use the apache caching capability.

I would make a php script that take as param an url and fetch it(nothing to funny just using curl).

Then I would setup apache to do some caching on the directory where you put the fetch script.

If you don't want to use apache you just have to add some code into the image fetcher like fetching the image if there is no cache or the cache is not expired. Cache lite would helps you to query and generate the cache.

RageZ
The problem are images are coming from diff. server and i don't have any access to make any changes in that image server.
text
you don't need access you can emulate that by doing some web request with curl (or something else. )
RageZ
you mean to save a local copy of image from other server to my server using curl?
text
yes and build some cache from that or let apache cache the php output result.
RageZ
it will cause a huge traffic to the site hundreds of images are going to process.
text
if you want to build some cache on some hot linked images ... there is no other way ....
RageZ
or just don't hot link ...
RageZ