You are here:  » Cached Images Not Valid on Pinterest


Cached Images Not Valid on Pinterest

Submitted by Retro135 on Fri, 2017-12-15 19:42 in

I'm trying to post products from shop pages or individually to Pinterest. I now get a "This is not a valid image." or "Can't save this page." message and can't post. I checked, and had posted cached images before w/out an issue. The only thing I've changed is that my site is now https. What am I doing wrong or need to change?

Submitted by support on Mon, 2017-12-18 10:12

Hi,

If cached images have been working with Pintrest previously I can't see why changing to https should have any impact; unless something has changed at Pintrest and for some reason it doesn't like the image URL not ending in any standard image extension. I checked the latest imageCache.php that I have from you in email and it is definitely sending the correct content-type header;

  header("Content-Type: image/jpeg");

If you could perhaps post an example image URL (I'll remove before posting your reply) I'll fetch it to check everyhing looks OK however it is possible to rewrite cached image URLs for example instead of;

/imageCache.php?src={BASE64_ENCODED_IMAGE_URL}

...into

/cimages/{BASE64_ENCODED_IMAGE_URL}.jpg

Cheers,
David.
--
PriceTapestry.com

Submitted by Retro135 on Mon, 2017-12-18 15:26

Ack, that was the issue, no .jpg extension, for example, the long {link saved}. I must have pinned the images before they cached somehow. OK, will make that change first.

Submitted by support on Mon, 2017-12-18 16:23

Hi,

To give this a go, first add the following new rule to the end of .htaccess

RewriteRule ^cimages/(.*).jpg$ imageCache.php?src=$1 [B,L]

And then to convert for Featured Products; look for the following code for the src attribute of the img tag at line 17 of html/featured.php:

src='<?php print $config_baseHREF."imageCache.php?src=".base64_encode($product["image_url"]); ?>'

...and REPLACE with:

src='<?php print $config_baseHREF."cimages/".base64_encode($product["image_url"]).".jpg"?>'

For Search Results, look for the following code for the src attribute of the img tag at line 19 of html/searchresults.php:

src='<?php print $config_baseHREF."imageCache.php?src=".base64_encode($product["image_url"]); ?>'

...and REPLACE with:

src='<?php print $config_baseHREF."cimages/".base64_encode($product["image_url"]).".jpg"?>'

And for the main product image, look for the following code for the src attribute of the img tag at line 32 of html/product.php:

src='<?php print $config_baseHREF."imageCache.php?src=".base64_encode($product_main["image_url"]); ?>'

...and REPLACE with:

src='<?php print $config_baseHREF."cimages/".base64_encode($product_main["image_url"]).".jpg"?>'

Hope this helps!

Cheers,
David.
--
PriceTapestry.com

Submitted by Retro135 on Mon, 2018-02-12 17:32

Hi David,
Didn't have a chance to try until now. No joy.

Still can't use B flag in htaccess, but worked without.

The replacement code didn't work, but when I added .".jpg" to the original code: ($product_main["image_url"]).".jpg"; ?>' .jpg extension was added to URL.

However, Pinterest still won't post image. All search results/feature page images disappeared, yet many appeared on the product page, which is where I attempted to post to Pinterest.

I reverted back to original to display images again.

Submitted by support on Tue, 2018-02-13 09:14

Hi,

If you would like to email me currently with working images html/product.php (I think you mentioned not using cached images at the moment) and also .htaccess and latest imageCache.php I'll check it out further with you...

Cheers,
David.
--
PriceTapestry.com