You are here:  » Cached Images: ok fetch, but, images not shown!


Cached Images: ok fetch, but, images not shown!

Submitted by smartprice24 on Fri, 2018-08-03 05:29 in

Hi, David. I have a small problem with the image cache!

My file is fetched correctly and saves the images in the folder.

But unfortunately, I can no longer show the images. Product, searchresults ... are not displayed.

My files are:

{code saved}

Can you help me understand where the problem is?

I have not understood anything for two days!

Thank you in advance.

Submitted by support on Fri, 2018-08-03 10:12

Hi,

To check if an error is occurring, I would start by making a copy of your imageCache.php script as imageCacheTest.php.

Then edit imageCacheTest.php and add the following lines to the very top of the script, immediately after the opening PHP tag:

  ini_set('display_errors','on');
  error_reporting(E_ALL);

And then where you have the following code beginning at line 104:

    header("Content-Type: image");
    print $img;

...REPLACE with:

    header("Content-Type: text/plain");

Then view a product page on your site and use View > Source to locate the imageCache.php src attribute for the main product image. Copy the URL, paste into the address bar of your browser and change imageCache.php to imageCacheTest.php to view the results.

If an error is displayed and you are not sure where the problem lies, of if the output is simply blank, let me know what (if anything) is displayed and I'll check it out further with you...

Cheers,
David.
--
PriceTapestry.com

Submitted by smartprice24 on Fri, 2018-08-03 11:38

Hi David. Many thanks for support.

I followed your advice and i get a blank page.

The image is saved. But it is not displayed.

Apache and nginx no errors in logs. mod_security and ip2failban disabled.

I'm confused. Php 7.1

Thanks David

Giuseppe

Submitted by support on Fri, 2018-08-03 12:30

Hello Giuseppe,

Could you possibly let me know an example product page URL (I'll remove before publishing your reply) where a cached image is not displaying)?

Thanks,
David.
--
PriceTapestry.com

Submitted by smartprice24 on Fri, 2018-08-03 13:07

Ok David.

{link saved}

and relative products pages.

Thanks!
Giuseppe

Submitted by support on Fri, 2018-08-03 13:26

Hello Giuseppe,

I think I can see the problem - when I tried the test version I noticed that the response was not completely empty (despite no error), so I looked at the raw binary data of an example image URL from your site and it begins with a new-line so it looks like there is some white space in your imageCacheSmall.php file outside of the PHP tags. To fix, edit the file and delete any spaces or new lines before the opening <?php (which should be line 1) and similarly at the end, make sure that ?> is all that is on the very last line - that should be all it is...

Cheers,
David.
--
PriceTapestry.com