You are here:  » Exclude images of a feed from caching


Exclude images of a feed from caching

Submitted by IG on Fri, 2016-04-29 13:44 in

Hi David

I am using image caching for my new site, which works generally very well. However, today I have imported a new feed, which somehow does not allow image caching. When I turn off image caching all images of that particular feed are visible, when I turn image caching back on, the images of that particular feed are all gone.

Is there a way to exclude images of one particular feed from caching?

Best regards,
Ivo

Submitted by support on Fri, 2016-04-29 14:07

Hello Ivo,

Sure - after your imageCache.php script has decoded the src attribute e.g.

  $src = base64_decode($_GET["src"]);

...to then 302 redirect requests for certain merchants (by domain) instead of fetching / serving a cached image, add the following code:

  if (strpos($src,"example.com"))
  {
    header("Location: ".$src);exit();
  }

...where example.com is the domain name from which the images that do not cache successfully are served. To include other domains, extend the IF condition e.g.:

  if (
     (strpos($src,"example.com"))
     ||
     (strpos($src,"example.net"))
     )
  {
    header("Location: ".$src);exit();
  }

Hope this helps!

Cheers,
David.
--
PriceTapestry.com

Submitted by IG on Fri, 2016-04-29 19:20

Works like a charm. Thanks a million! You are simply the best!