Making sure that the URL of the image changes is of course a good idea.

However, as the content of the image changes, would it not be much more logical to change the filename, rather than adding a dummy parameter?

Security wise it would also stop anyone from "stealing" images to which he should have no access, by simply directly requesting $image_web_path.'imagefile6.gif over and over again.Using a module such as Data::UUID can give you a unique identifier everytime you ask for one. If you clean the server-side "cache" of your files on a regular basis, it becomes almost impossible to guess the file name of any of the files in the cache, thus protecting the contents of these graphic files. The actual odds of guessing right would be 1 / (2^128) times the number of files (or better than 1 in 30 million300 billion billion billion billion times the number of files) in your cache.

CountZero

A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James


In reply to Re^2: Web server cache-ing? by CountZero
in thread Web server cache-ing? by campbell

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.