Search code examples
phphtmlpinterestsocial-media

Pinterest Sharing Option


So I'm currently making custom social media sharing buttons and have run into a bit of an issue with Pinterest. After multiple hours and numberous google searches, I've come up with what seems to be the proper way to do it, as seen below:

<li>
    <a target="_blank" href="http://pinterest.com/pin/create/bookmarklet/?url=http://www.islandcompany.com/<?= $product->url; ?>&is_video=false&description=<?= $product->meta_description; ?>">
        <img src="/media/island/catalog/social-media/pinterest-2.jpg" />
    </a>
</li>

When I click my custom button, it takes me to the Pinterest share screen and has the description and name of the product. But I never get an image to return. I've tried both options "&media= " and "&image_url= " but neither have returned an image. I'm using php to grab both the descriptions and images and I know they're working because the descriptions are being pulled. But the images don't seem to be working even when I include a basic image pulled off of google images. Anyone have any insight to this problem?

I know there are a ton of questions that have been asked just like this one but I really haven't found a working solution from any of those questions as I've tried all of the solutions found in them.


Solution

  • href="http://pinterest.com/pin/create/bookmarklet/?url=http://www.islandcompany.com/<?= $product->url; ?>&is_video=false&description=<?= $product->meta_description; ?>&media=http://www.islandcompany.com/<?= $product->getMainImage('large')->url; ?>
    

    I was missing a few linking issues with my URL path for my image. All resolved now. This code, altered a little bit for your own image paths and meta descriptions, will work!