• Resolved Janine

    (@tidy)


    Hello,

    Thanks for this great plugin. I just have a query about the custom pinterest image size.

    I uploaded an image 1000×1500 for this, but the mobile size seems to be the one picked up by Pinterest which is only 450×675 and does not look as good quality on Pinterest for various large views.

    The img tag put out in the source is:
    <img width="450" height="675" src="https://www.mydomain.com/wp-content/uploads/mypin-450x675.jpg" class="scriptless__pinterest-image" alt="My pin image" data-pin-media="true" style="display:none;" srcset="https://www.mydomain.com/wp-content/uploads/mypin-450x675.jpg 450w, https://www.mydomain.com/wp-content/uploads/mypin-360x540.jpg 360w, https://www.mydomain.com/wp-content/uploads/mypin-600x900.jpg 600w, https://www.mydomain.com/wp-content/uploads/mypin-768x1152.jpg 768w, https://www.mydomain.com/wp-content/uploads/mypin-533x800.jpg 533w, https://www.mydomain.com/wp-content/uploads/mypin.jpg 1000w" sizes="(max-width: 450px) 100vw, 450px" />

    I think Pinterest might be taking the image from the src attribute rather than the srcset? Is there any way to set the src to use the full size of the uploaded image?

    Thanks,
    Janine.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Robin Cornett

    (@littlerchicken)

    Hi Janine! The plugin uses your site’s “large” image size to add the Pinterest image to the content–since the default for that is set to 1024 pixels on either side, it is usually a sufficient size. My guess is that your site’s “large” image size is set to something smaller than that, and that’s why the image being output is small (the actual image being output is what’s used by Pinterest).

    One option would be to check your site’s Media Settings and increase the “large” image size, but I’ll assume that it’s set the way I’m guessing it is for a particular reason.

    I think for users in your situation, I would need to add a filter to allow you to select a different image size (or the original) to be used for Pinterest, and then you would have to add some code to your site to use the alternative size (which could be the original, full size image).

    I’ve gone ahead and added the filter to the plugin on GitHub. If you would like to try it on your site and are comfortable replacing a file and adding some code, here’s how:
    Replace the Pinterest output class file with the updated one from GitHub via FTP. Then add this filter to your site, wherever you add code modifications:

    
    add_filter( 'scriptlesssocialsharing_pinterest_image_size', 'prefix_modify_pinterest_image_size' );
    /**
     * Set Scriptless Social Sharing's Pinterest image to use the full size image
     * instead of the large image.
     *
     * @return string
     */
    function prefix_modify_pinterest_image_size() {
    	return 'full';
    }
    

    Make sure your site files are backed up before tinkering, but this will have the plugin use your full size image for the Pinterest image output.

    Thread Starter Janine

    (@tidy)

    Hi Robin,

    Thank you so much for taking the time to explain all this & add an extra filter so soon just to allow for this. I’m so impressed at this level of support for a free plugin!

    The new filter works great so I really appreciate this.
    I am new to Pinterest & my blog images are usually landscape, whereas it seems Pinterest wants tall 2:3 ratio images that aren’t used anywhere else.

    Thanks again,
    Janine.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Custom Pinterest Image using mobile size’ is closed to new replies.