Add a new data attribute in <img> tag

I would like to use Qazy Lazy load and I need to include new data attribute data-qazy="true" inside all img tags. I tried to include with this function, but it only applies for sidebar images and doesn’t work for the post images:

function add_lazyload_atts( $atts, $attachment ) {
    if ( ! wp_get_attachment_image_src( $attachment ) ) {
    $atts['data-qazy'] = 'true';
    }
    return $atts;
}
add_filter( 'wp_get_attachment_image_attributes', 'add_lazyload_atts', 10, 2 );

Solutions Collecting From Web of "Add a new data attribute in <img> tag"