You are here:  » Cached images not showing


Cached images not showing

Submitted by IG on Mon, 2020-09-28 12:50 in

Hi David,

I have just added another feed. The image urls of this feed work as expected. However, when I import the feed the cached images are not showing. With none of the other 67 imported feeds I have this problem.

What could be the problem?

Kind regards,
IG

Submitted by support on Mon, 2020-09-28 13:10

Hi,

A possibility is that the images are being served over https (secure) but your server doesn't have the authority certificates required to validate the connection. If that is the case you can disable verification with the mod described in this comment and that should do the trick...

Cheers,
David.
--
PriceTapestry.com

Submitted by IG on Mon, 2020-09-28 14:44

Hi David,

Unfortunately, this did not resolve the issue. Please note that many of my feeds serve images over https.

Any other idea(s)?

Kind regards,
IG

Submitted by support on Mon, 2020-09-28 14:52

Hi,

Another (although less common) reason would be the remote server checking for browser user-agent strings - this can be set by another curl option as per this comment. It might also be worth emptying the cache folder in case invalid images have been returned where this is the case...

Cheers,
David.
--
PriceTapestry.com

Submitted by IG on Tue, 2020-09-29 07:23

Hi David,

I will give it a try. What is the easiest way to empty the cache folder? Doing this with Filezilla is a pain as there are thousands of images in the cache folder. Or shall I just delete the whole cache folder and than create a new one?

Kind regads,
IG

Submitted by support on Tue, 2020-09-29 07:46

Hi,

The easiest way using Filezilla I think would be;

1) Rename cache folder to cacheold

2) Create new cache folder and set permissions (777)

3) Delete cacheold folder

That way, if the delete operation takes a long time the site isn't impacted at all...

Cheers,
David.
--
PriceTapestry.com

Submitted by IG on Thu, 2020-10-01 08:38

Hi David,

I made all the changes in imageCache.php and deleted the cache, but the images are still not showing.

Kind regards,
IG

Submitted by support on Thu, 2020-10-01 08:45

Hi,

Could you let me know 2 example image URLs from your feeds, one from one of the feeds where the images cache works, and one from the feed where they are not working (I'll remove the links before publishing your reply) and I'll check it out further for you...

Thanks,
David.
--
PriceTapestry.com

Submitted by IG on Thu, 2020-10-01 08:55

Hi David,

Here you go.

{links saved}

Kind regards,
Ivo

Submitted by support on Thu, 2020-10-01 09:26

Thanks Ivo,

I'm not totally sure what's going on here - please could you try one more test on your server - edit imageCache.php and where you have the following code at line 22:

    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);

...and REPLACE with:

    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($ch, CURLOPT_REFERER, $_SERVER["HTTP_REFERER"]);

(don't forget to clean cache/ folder as previously)

Thanks,
David.
--
PriceTapestry.com

Submitted by IG on Thu, 2020-10-01 09:41

Hi David,

I cleaned the cache/ folder and also the cache of the browser, but unfortunately no change. Images are still not showing.

Kind regards,
IG

Submitted by support on Thu, 2020-10-01 10:43

Thanks Ivo,

I've tried various methods but can't get this particular source to work with cacheing so far! I will keep looking it but in the mean time I would suggest temporarily re-register and import this feed without the Image URL field registered (if it auto-detects on Feed Registration Step 2 just change the drop down back to "select field..."...

Apologies for the inconvenience;

Cheers,
David.
--
PriceTapestry.com

Submitted by IG on Thu, 2020-10-01 10:55

Hi David,

Thank you for your kind support. I will check with the feed provider, if there is something they can do.

Is there an easy way to exclude the images of this particular feed from being cached?

Kind regards,
IG

Submitted by support on Thu, 2020-10-01 11:35

Hi,

Sure - one option would be to issue a Location: header for this domain (and any others that have similar issues). To try this edit imageCache.php and look for the following code at line 93:

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

...and REPLACE with:

  $src = base64_decode($_GET["src"]);
  $host = parse_url($src,PHP_URL_HOST);
  $redirectHosts = array("www.example.com");
  if (in_array($host,$redirectHosts))
  {
    header("Location: ".$src);
    exit();
  }

Replace www.example.com with the host of the image URLs not working; and to add any others in the future just add to the array e.g.

  $redirectHosts = array("www.example.com","www.example.org");

Cheers,
David.
--
PriceTapestry.com

Submitted by IG on Thu, 2020-10-01 14:47

Hi David,

Above solution did the trick.

Thanks a lot.

Kind regards,
IG