You are here:  » Images with tildes in URL not appearing

Active Forum Topics


Images with tildes in URL not appearing

Submitted by Retro135 on Thu, 2019-08-29 23:45 in

I couldn't figure out why some images in a particular feed appeared and others didn't. I checked individual products in Feed Utilities. What it seems is that some of the image urls include tildes ~, these are the missing images, but the image appears in Feed Utilities. I thought tildes could appear in URLs. I do use PT image caching. How can I fix this?

Submitted by support on Fri, 2019-08-30 09:29

Hi,

It think ~ needs to be URL encoded before passing to the fetch function - in your imageCache.php (I looked at the latest version I have in email) look for the following code at line 126:

  $src = str_replace ( ' ', '%20', $src);

...and REPLACE with:

  $src = str_replace ( ' ', '%20', $src);
  $src = str_replace ( '~', '%7E', $src);

Hope this helps!

Cheers,
David.
--
PriceTapestry.com

Submitted by Retro135 on Sun, 2019-09-01 19:58

Was exactly where you stated, however, no joy. I even imported an updated feed, re-registered it, & imported. Most images still missing. I use Cloudflare, turned off caching for shops section, even purged all cache from entire site. What's odd is that similarly titled items with only color/size difference have some images coming up, others not.
A couple example pages:
{link saved}

Submitted by support on Mon, 2019-09-02 11:19

Hi,

Thanks for the example - there is literally, as you say, no difference between the working and not working URLs other than the size etc. and when I decoded the base64 and requested "not working" examples they were working fine..

So what I am actually wondering may be happening here is that the server hosting the images is intermittently returning invalid responses which are being cached. To check if this is the case, edit your imageCache.php and where you have the following code at line 71:

    if (!$res = imagecreatefromstring($img)) return FALSE;

...REPLACE with:

    if (!$res = imagecreatefromstring($img))
    {
      unlink($filename);
      return FALSE;
    }

Then clear the image cache folder and try the examples again - some images may still fail but then try again a few moments later and they should then appear if this is the case...

Cheers,
David.
--
PriceTapestry.com

Submitted by Retro135 on Tue, 2019-09-03 12:17

Solved! I went into the feed and replaced tildes with %7E. That did it.