Solved

How to make images cache in a e-commerce sites

Posted on 2013-12-30
4
287 Views
Last Modified: 2014-01-03
We are using a windows server to serve the images to our e-commerce site. The images are fetched using a flat url. and there is no set time out used in image tags.
So the images are being downloaded every next day if somebody accesses our site.

We may use some scene7 server  or akamai kind of CDNs to cache our content. But I would like to know if there a way we can set time for caching static resources like image/css/js etc?

Or is there any other possible solution to download image from a server and make use of browser caching. ?
0
Comment
Question by:Ramdasa Mayya
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 9

Expert Comment

by:David Carr
ID: 39748346
Here is some code you can put in your HTML in the <head> section
<script type="text/javascript">

<!-- hide from non JavaScript Browsers

Pic1= new Pic
pic1.src = "pic1.jpg"

Pic2 = new Pic
Pic2.src = "pic2.jpg"

// End Hiding -->
</script>

Open in new window


You can specify the height and width of the images by adding dimensions after new Pic ie.New Pic(150,150).

Add other images as needed and increment with Pic 3, Pic 4 etc.
0
 
LVL 58

Accepted Solution

by:
Gary earned 500 total points
ID: 39748415
This will depend on your HTTP server (?) on how you set the expiry date for assets.
0
 
LVL 4

Author Comment

by:Ramdasa Mayya
ID: 39754561
That may be a http server settings. Is there any other way to set the expiry time on dynamic images/js ?
0
 
LVL 58

Expert Comment

by:Gary
ID: 39754583
What exactly do you mean by dynamic? Dynamically generated?
It shouldn't make any difference, it is still an image/file

Is this on IIS or Apache? PHP or .net...?

If IIS just amend the web.config like so to cache for 30 days

<configuration>
  <system.webServer>
    <staticContent>
      <clientCache cacheControlMode="UseMaxAge" cacheControlMaxAge="30.00:00:00" />
    </staticContent>
  </system.webServer>
</configuration>
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Digital marketing agencies have encountered both the opportunities and difficulties that emerge from working with a wide-ranging organizations.
This article was initially published on Monitis Blog, you can read it here . When it comes to deciding which approach to website performance monitoring is best for your business, unfortunately, like so many options in life . . . it depends. In th…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

742 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question