You are here:  » No Product Images!


No Product Images!

Submitted by Perce2 on Thu, 2018-02-22 05:39 in

Just spotted an issue effecting only one merchant on my site. That is, no images display, thumb or main.
If I copy and paste the merchant image url from the data feed into a browser, the image shows fine.
This site uses the imagecache.php method to prevent https:// security warnings.
Anybody else had this problem or any idea what might be causing it ?

Submitted by support on Thu, 2018-02-22 08:30

Hi,

It might be that the server is only returning images to browser looking user-agents - you could try setting the user-agent presented by CURL - to do this, edit imageCache.php and look for 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_USERAGENT,"Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)");

Don't forget to clear your cache directory to remove any cached failed requests from previous calls...

Hope this helps!

Cheers,
David.
--
PriceTapestry.com

Submitted by Perce2 on Thu, 2018-02-22 09:10

Hi David,

Thanks for your quick reply.
Gave that a try, same results !

The only thing I can see that looks different to the image urls with this merchant is that they show a .jpeg file type as opposed to .jpg (like my other merchants). Could that cause an issue ?
Thanks.

Submitted by support on Thu, 2018-02-22 09:17

Hi,

The original image extension shouldn't make any difference - what I would try next is forcing PHP rather than CURL fetch - to do this edit imageCache.php and look for the following code at line 8:

    if (function_exists("curl_init"))

...and REPLACE with:

    if (FALSE)

If still no joy, if you could let me know an example image URL that is not working through cache i'll give it a go on my test server (I'll remove the URL before publishing your reply...)

Cheers,
David.
--
PriceTapestry.com

Submitted by Perce2 on Thu, 2018-02-22 09:32

Gave that a go, unfortunately gave same results...

Image url from DB:
{link saved}

Thanks.

Submitted by support on Thu, 2018-02-22 10:32

Hi,

It didn't work at first on my server - so I added the CURL setting to disable verifying the https certificate and it then worked fine (authority certificates can get out of date pretty quickly on servers unless the underlying libraries and certificate store are updated regularly). To apply this, edit imageCache.php and look for 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_SSL_VERIFYPEER, FALSE);

Because this workaround will need to use the CURL method, don't forget to undo the above suggestion by restoring line 8 as follows;

    if (function_exists("curl_init"))

Cheers,
David.
--
PriceTapestry.com

Submitted by Perce2 on Thu, 2018-02-22 10:42

Excellent work David, works like a charm!

As always, appreciate your A++ support, help and guidance.
Many thanks.

Submitted by Perce2 on Wed, 2018-06-20 10:38

Hi David, hope you are well...

Have noticed I have the exact same problem described in this post on another site now.
Have tried all of the above suggestions but still have no images displayed.

This only effects one merchant. Other identical sites I have using the same merchant datafeed work fine. Seems to be merchant/server related.
You can see here: {link saved}

Any idea what might be causing the problem?

Thanks

Submitted by support on Wed, 2018-06-20 12:03

Hi,

The image URL worked fine with imageCache.php on my test server also (without any of the work-arounds above) - so it does look like something specific to this server.

To debug, if you edit imageCache.php and look for the following code at line 32:

    $img = curl_exec($ch);

...and REPLACE with:

    $img = curl_exec($ch);
    if ($img===FALSE)
    {
      print curl_error($ch);
      exit();
    }

Then view your page where the images are not working, right-click on one of the broken image links and use the "Copy image location..." function to capture the imageCache.php URL. Paste this directory into the web browser address bar, and the CURL error message (if any) should be displayed.

If you're not sure from what is displayed where the problem lies (or if no error displayed - just a timeout for example), let me know what happens and I'll check it out further with you...

Cheers,
David.
--
PriceTapestry.com

Submitted by Perce2 on Wed, 2018-06-20 12:45

Hi David,
thanks for your reply.

Tried that, I got a Request Timeout.

Url - {link saved}

Thanks

Submitted by support on Wed, 2018-06-20 13:00

Yes - that's what I got when I first tried the imageCache.php link on your server. If you have command line access (e.g. via SSH), see if you can ping the server:

ping www.example.co.uk

(where example.co.uk is the domain name of the merchant)

If that fails, it may be an outbound issue specific to that destination in which case it would be worth contacting your host, let them know the merchant's domain name and ask if they can check whether there is an outbound http connection issue to that host (mention that outbound http works fine for other hosts)...

Cheers,
David.
--
PriceTapestry.com

Submitted by Perce2 on Thu, 2018-06-28 13:59

Hi David, thought I'd update the status of this post...

Still have products with no images.

I have been in touch with both my host and merchant and seem to be getting nowhere.
My host say's there could be a connection problem as their attempt to connect to the images appears to be blocked, but the merchants host say there is no blocked connections to my hosts IP !

One thing I have noticed, by pasting the datafeed image url directly into a web browser produces the correct image, surely this proves it's not a connection problem, maybe more to do with the imagecache url ?

Any ideas ?

Submitted by support on Fri, 2018-06-29 09:02

Hi,

Have a go with the following test script;

<?php
  $src 
"http://www.example.com/image.jpg";
  
$ch curl_init($src);
  
curl_setopt($ch,CURLOPT_HEADER,0);
  
curl_setopt($ch,CURLOPT_FOLLOWLOCATION,TRUE);
  
curl_setopt($ch,CURLOPT_RETURNTRANSFER,TRUE);
  
$img curl_exec($ch);
  if (
$img===FALSE)
  {
    print 
"Error: ".curl_error($ch);
  }
  else
  {
    print 
"Bytes Received: ".strlen($img);
  }
?>

Change the URL in the first line to one of the image URLs that are not working, save as for example test.php and browse to the script - do you get a CURL error message displayed; the Bytes Received message, or timeout?

Cheers,
David.
--
PriceTapestry.com

Submitted by Perce2 on Wed, 2018-09-19 05:06

Hi David, hope you are well...

Having another issue with product images not showing for just one merchant in a WP installation.Yet on another installation but none WP, on the same server, the same merchants product images are showing fine.

Examples: one site WP, the other standalone. Both sites on the same server.
{links saved}

Have used the above test script, getting - "Bytes Received: 0"
Any idea what could be the cause ?

Thanks.

Submitted by support on Wed, 2018-09-19 08:05

Hi,

I notice that it's only the WordPress site that is using imageCache.php, but also from the non-WordPress site that the image URLs are https (secure) so I wonder if it is the situation where your server doesn't have the necessary authority certificates to verify the SSL connection. To check if this is the case, edit your imageCache.php and where you should have the following code around line 21:

    curl_setopt($ch,CURLOPT_FOLLOWLOCATION,TRUE);

...REPLACE with:

    curl_setopt($ch,CURLOPT_FOLLOWLOCATION,TRUE);
    curl_setopt($ch,CURLOPT_SSL_VERIFYPEER,FALSE);
    curl_setopt($ch,CURLOPT_SSL_VERIFYHOST,FALSE);

Hope this helps!

Cheers,
David.
--
PriceTapestry.com

Submitted by Perce2 on Wed, 2018-09-19 09:29

We're all good now!
Many thanks David