This does not work because the srctag attribute <img>must not contain raw image data; rather, it should contain a URI that points to image data.
data: URI, (X) HTML-. , , Internet Explorer. , , IE8 32 URI data:.
PHP, :
<img src='data:image/png;base64,<?php echo base64_encode(file_get_contents("dir/dir/img.png")); ?>'>
image/png URL-, . , GIF, image/gif.