Support » Plugin: Send Images to RSS » Images Overlapping

  • Resolved jldimatteo

    (@jldimatteo)


    The plugin seems to be resizing some of the smaller images included in my blog post (resizing from 120px to 200px). In the ‘Supplies’ section of my blog post, the images are now overlapping after I installed your plugin. If I deactivate the plugin, the images go back to the size I have them set at (110px). I included the link to my latest Mailchimp campaign above. Here’s a link to the actual blog post: https://thepaperpixie.com/2018/05/love-what-you-do-mini-card-set.html. I’ve tried everything with all the different settings. The supplies section is created with HTML code, but that code defines the image as 120px. Maybe it’s getting overwritten by the image source the html code is pointing to? The max size of the images from the site I used to create supply lists from is 200px, so that could be the problem. Any ideas how to fix?

    The page I need help with: [log in to see the link]

Viewing 3 replies - 1 through 3 (of 3 total)
  • I figured it out. In the supplies list I use I just set the images to 200px (the max width) in the html code to fix the problem.

    Plugin Author Robin Cornett

    (@littlerchicken)

    I’m glad you found a solution! I have an alternative (or additional) option which you may want to explore as well. There is a filter you can use to change the image style that the plugin applies. I copied your HTML into a local install and tested the feed, and this worked for me. It isn’t ideal, because it’s not a very smart decision process (I’m thinking I should implement a better filter here, actually), but if your images always meet this specific criteria, it may be an option:

    
    add_filter( 'send_images_rss_other_image_style', 'prefix_modify_supplies', 10, 6 );
    /**
     * Maybe modify RSS feed images.
     * @param $style
     * @param $width
     * @param $maxwidth
     * @param $halfwidth
     * @param $alignright
     * @param $alignleft
     *
     * @return string
     */
    function prefix_modify_supplies( $style, $width, $maxwidth, $halfwidth, $alignright, $alignleft ) {
    	if ( $alignright || $alignleft ) {
    		return $style;
    	}
    	// This will modify the image styles only on images which are exactly 200px wide.
    	if ( 200 === $width ) {
    		$style = 'display:block;max-width:110px;margin:auto;';
    	}
    
    	return $style;
    }
    

    Basically it checks first to see if the image has the standard WordPress alignright or alignleft image classes added. If so, it doesn’t do anything. (Your images in the supply list don’t have any classes, and I expect would not ever have these two.) Then, it checks the image width, and makes a modification only if the image width is 200. If it’s something different at all, nothing will happen. If it is 200, then the filter will set the max-width on the image to 110px.

    If your supply images, and only those images, will always meet this criteria, this may be a helpful solution for you. If you use this code, please back up your files before adding it to your site, and practice safe coding.

    Thank you so much for your reply! I will definitely look into this.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Images Overlapping’ is closed to new replies.