Take the 2-minute tour ×
Graphic Design Stack Exchange is a question and answer site for professional graphic designers and non-designers trying to do their own graphic design. It's 100% free, no registration required.

Sometimes i find images on the sites added through css. Even if image name is (let's say) footer_logo.gif. In css it will be added as footer_logo.gif?1297280570

What do I miss in here?

Regards,

share|improve this question
add comment

2 Answers

The chances are that it's a cachebuster - used to ensure that the url is unique (typically a random number or a time stamp) and that the image is therefore forced to be reloaded. It might be used where images are generated by the server on the fly, as an alternative to using a different actual image name every time (which has knock on implications), this mechanism just ensures that the image is always reloaded.

See this page describing more info about cachebusters

I would imagine this number is almost certainly a timestamp, as it's encoding a date this year in unix time - the number of seconds since Jan 1 1970. Converting your number into a date, you get Wed Feb 09 2011 19:42:50 GMT+0000 which would be the last time that image was generated.

Of course it's not necessarily anything to do with the image or css. The question mark simply denotes that what is about to follow are some parameters passed in the url to the web server, which can be used for whatever is relevant on the website:

See http://stackoverflow.com/questions/574493/what-is-the-symbol-in-url-used-for-in-php

share|improve this answer
    
True, but the question is really what it's for when used in images. –  e100 Jul 15 '11 at 12:09
    
fair point - I have modified my answer to make it related to images –  Roger Attrill Jul 15 '11 at 12:30
1  
1302118869 = Wed Apr 06 2011. Probably it was the last time that page was regenerated. It just ensures that you always see the image on the website, not the one cached on your machine. It may not have actually appeared to change since YOU last visited it, but who's to say it hasn't changed back and forth in the mean time? –  Roger Attrill Jul 15 '11 at 15:19
2  
@funguy Imagine you have an image header.gif for, say, a 10K race website. You need that image to change when the race is finished, i.e. put the word "finished" on it somewhere. However, browsers like storing images locally because they take so long to download from the internet. So there is a chance that after you update the image someone will visit the site and see the original header.gif and not know the race has finished. You could avoid this by changing the file name (header_finished.gif) or just using a timestamp (?1302118869), which all browsers treat as a separate file. –  citelao Jul 15 '11 at 15:24
1  
@funguy not a website race - a website about a 10,000 meter running event. As another example lets say your header image on an e-commerce shopping site has occasional promotional or status messages built into the image. Instead of cluttering your server with different image files and having to come up with a new unique file name that you know you haven't used before, EVERY time you update or revert the header image on the website - this mechanism would allow you to use the same image file name whilst ensuring that visitors will always see the latest version. –  Roger Attrill Jul 17 '11 at 8:45
show 3 more comments

Probably that's a cache prevention or a version number or a tracking method or someting else.

For example:

If you just place footer_logo.gif, everytime the image loads it may be stored in the cache memory of your browser (so the next times it loads it will fetch that cached version, it's faster).

If you plan to refresh it, you can add a query (in your example it's 1297280570), this way you tell the browser to refresh it (as long as it hasn't been loaded before). After that it will be cached again (it depends on the browser and webpage settings).

If it's a version number, it will work in the same way as the previous example, the "difference" is that it tells the developer which version it is using; In this case it can also use a dynamic system to change the image, it's more complex to explain here and would probably be done in a different way.

If it were a tracking method, when the image was loaded, the server would gather that query and use it in its statistics, etc.

It can be something else...

BTW, this question could belong to stackoverflow.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.