Support » Plugin: Send Images to RSS » Max-width 100%

  • Setting max-width to a pixel size causes issues in the gmail on mobile devices.
    the images with the width=600px and max-width: 600px are stretched outside the edge with a horizontal scroll bar…

    Screenshot: https://i.imgur.com/1BIxQyT.png

    The image max-width should be 100% for full-width images.

    I’ve unsuccessfully attempted to modify it using:
    add_filter( ‘send_images_rss_email_image_style’, ‘rgc_email_images’, 10, 2 );
    function rgc_email_images( $style, $maxwidth ) {
    return sprintf( ‘display:block;margin: 0 auto 10px; max-width:100%;’, $maxwidth );
    }

    Had to manually temporarily change:
    protected function build_image( $image_source ) {

    $rss_option = get_option( ‘rss_use_excerpt’ );
    $alignment = $this->setting[‘alignment’] ? $this->setting[‘alignment’] : ‘left’;
    $style = $this->set_image_style( $alignment );
    $max_width = isset( $this->setting[‘image_size’] ) ? $this->setting[‘image_size’] : get_option( ‘sendimagesrss_image_size’, 560 );
    if ( ( ‘1’ === $rss_option || $this->can_process() ) && isset( $image_source[1] ) && $image_source[1] > $max_width ) {
    $style .= ‘ max-width:100%;’;
    }

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

    (@littlerchicken)

    Looking at the code you’ve shared, I think you are using the excerpts in your feeds, in which case the image filter hook you want to use is send_images_rss_excerpt_image_style, not send_images_rss_email_image_style. That should allow you to change the max width without modifying the plugin files.

    The max-width value was originally set to pixels instead of a percentage because of some older email clients which do not understand max-width as a percentage value. More modern email clients handled the responsiveness more gracefully.

    I have not experienced the issue shown in your screenshot–can you be more specific about the mobile device and email client where you encountered it? Sharing your feed URL may help me to troubleshoot as well.

    Here are the settings we use:

    Admin > Settings > Reading:
    For each article in a feed, show – Full text

    And the plugin’s settings:
    https://i.imgur.com/KKakzRb.png

    With those settings I was not able to modify the output of the build_image() function. Had to modify it in the source of the plugin [I know this is a bad idea and will be overwritten on update].

    As of the max-width CSS, you should place the CSS output as following:
    max-width:123px; max-width: 100%;

    All the dummy email-clients will skip the last rule with the %, but follow the previous with the ‘px’.

    Thank you for a great plugin!

Viewing 2 replies - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.