Go to your custom html, click inside the html and press ‘ctrl’ & ‘F’. in the search box type {/block:Photo}. At the moment it will look like this <img src=”http://static.tumblr.com/pxybwue/iMilsauy4/heartb.png”>Reblog this post</a></div>{block:Photo}{/block:Photo}
CUT the {block:Photo} and move it to here
{block:PermalinkPage}
{LinkOpenTag}
<img src=”{PhotoURL-400}” alt=”{PhotoAlt}”/>
{block:Caption}{Caption}{/block:Caption}
{LinkCloseTag}
{/block:PermalinkPage}
{block:Caption}{Caption}{/block:Caption}{/block:Photo}
This is just underneath where you copied the original code from.
Save, and no more dead images!