wordpresswordpress-jetpack

Wordpress jetpack post by email - controlling image size


Has anyone found ways to gain more control of images created when using the Wordpress Jetpack "Post by Email" feature?

Ideally, when posting by email, I want my images to appear the same size as those attached to the email. As is Post by Email only posts them maximized to 1024x1024.


Solution

  • You can fix this by inserting the following code into your functions.php

    add_filter( 'post_thumbnail_html', 'remove_width_attribute', 10 );
    add_filter( 'the_content', 'remove_width_attribute', 10 );
    
    function remove_width_attribute( $html ) {
        $html = preg_replace( '/(width|height)="\d*"\s/', "", $html );
        return $html;
    }
    

    As described here: http://css-tricks.com/snippets/wordpress/remove-width-and-height-attributes-from-inserted-images/