Image Caching in PHP with automated script

Discussion in 'PHP' started by Skinny, Mar 6, 2007.

  1. #1
    Okay this script is searching for images within an rss feed.

    So since I know the url of the image i.e. http://www.websiterrrrr.com/image.jpg how can I cache this? Are there some simple scripts that allow me to do this?

    Also does this save time on the user's end or is it the same amount of time for the user when the page is loaded.

    TY

    Skinny
     
    Skinny, Mar 6, 2007 IP
  2. phper

    phper Active Member

    Messages:
    247
    Likes Received:
    17
    Best Answers:
    0
    Trophy Points:
    60
    #2
    Are you trying to display the list of images found in the RSS feeds on your site
    ? If so, first thing to consider I guess is, what do the target sites allow you
    to do? Do they allow you to hot-link the images? Do they allow you to store a copy of them?
     
    phper, Mar 6, 2007 IP
  3. Aragorn

    Aragorn Peon

    Messages:
    1,491
    Likes Received:
    72
    Best Answers:
    1
    Trophy Points:
    0
    #3
    Usually server side image caching is performed when the image is created Dynamically using PHP, ie after creating/resizing an image using GD etc. Also, I don't think it will speed up the downloading process for the user (I am not sure)
     
    Aragorn, Mar 7, 2007 IP
  4. PhatDV

    PhatDV Peon

    Messages:
    13
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Since you know the URL of the image, just use copy() to save a local copy of the file.

    With regard to caching, the only benefits for your users are:

    1. Faster loading times if your server is faster than the server hosting the rss feed
    2. You keep a copy of the image if the rss is pulled or the image itself is pulled.
     
    PhatDV, Mar 7, 2007 IP