Shortcode to easily make WordPress Images Responsive

Put this code on the functions.php

function responsive_images($atts, $content = null) {
     return '<div class="image-resized">' . $content .'</div>';
}
 
add_shortcode('responsive', 'responsive_images');

Once done, open your style.css file and add this:

@media only screen and (max-width:767px) {
    .image-resized img {
        width:100%;
        height:auto;
    }
}

You can now use the [responsive] shortcode in your posts

[responsive]<img src="image_url" alt="alt" title="title" />[/responsive]

Source