Solved

HTML Cache External Images Only

Posted on 2012-12-25
8
357 Views
Last Modified: 2012-12-25
In process of trying to optimize http://www.dealer24x7.com/Used/1/Inventory/ the recommendation we are getting from google's page speed insights (https://developers.google.com/speed/pagespeed/insights) is to leverage caching.

What meta tag do we need to use to specify caching images (local and external) longer (say 3 months) and caching the HTML of the page for only a week?


p.s.
The goal is to leverage public cache pools by using
<META HTTP-EQUIV="CACHE-CONTROL" CONTENT="PUBLIC">
0
Comment
Question by:ullfindsmit
  • 3
  • 3
  • 2
8 Comments
 
LVL 17

Expert Comment

by:selvol
Comment Utility
It's not a META tag.

Its a server Issue  or setting

If you use IIS

http://www.iis.net/learn/manage/managing-performance-settings/configure-iis-7-output-caching

Selvol
0
 
LVL 12

Author Comment

by:ullfindsmit
Comment Utility
Unfortunately some (or even a good majority) of the images come from third party servers that I have no control over
0
 
LVL 82

Expert Comment

by:Dave Baldwin
Comment Utility
Image files don't have META tags or any other HTML in them.  That would have to be done on the server.  Here's a page about doing in Apache:  http://www.chicagostyleseo.com/2010/04/googles-need-for-speed-use-cache-and-htaccess-to-speed-up-your-site/  I don't know how to set this up in IIS.  I that in the other comment.

If they're from third party servers, there is nothing you can do about it.
0
 
LVL 12

Author Comment

by:ullfindsmit
Comment Utility
So is there an HTML tag on the HTML page that I can use to say cache this page and its contents (local and external images) for 7 days?
0
What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

 
LVL 82

Expert Comment

by:Dave Baldwin
Comment Utility
No.
0
 
LVL 17

Accepted Solution

by:
selvol earned 500 total points
Comment Utility
Depending on your need to do this.

I'll just put this out  here.  
I have used this in the past.
What is does is takes an external Image and makes it local..
(FOR JPG's)
Create this page on your server in the root DIR and Name it extimage.php
NO Spaces BEFORE this.

<?php header('Content-type: image/jpg') ; 
$external_image = file_Get_contents($_GET['url']);
echo $external_image; ?>

Open in new window



Link to it like so
http://www.dealer24x7.com/extimage.php?url=http://photos.ecarlist.com/05/mg/gF/ao/gQ/gI/1X/r8/6H/KZ/dg_640.jpg

Open in new window



To add it into HTML would be like

<img src="http://www.dealer24x7.com/extimage.php?url=IMAGE PATH TO EXTERNAL JPG HERE">

Regards SELvol
0
 
LVL 12

Author Closing Comment

by:ullfindsmit
Comment Utility
While it aint pretty, it does the job
0
 
LVL 17

Expert Comment

by:selvol
Comment Utility
Glad You appreciate that script....

Who needs pretty, when your sneaky.

You could Save the external image to a local FOlder.
 Add a Check to see if the File exists before the PHP
gets the external Image.



Regards Selvol
0

Featured Post

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Someone recently asked me about how to display a progress indicator on a page while an iframe is loading. And I remember when I first came across this myself. It was a bit tricky to get my head around, but really, it's very simple. The most impor…
Not sure what the best email signature size is? Are you worried about email signature image size? Follow this best practice guide.
In this tutorial viewers will learn how add a scalable full-width header using CSS3. Create a new HTML document with an internal stylesheet. Set a tiled background.:  Create a new div and name it Header. Position it with position:absolute at the top…
In this tutorial viewers will learn how to position items using CSS's three positioning types Create a new HTML document with an internal stylesheet.: Create another div in CSS and name it Absolute : Type "position:absolute;" and "top:10px; left:50p…

762 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

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now