I tried your plugin and i want to integrate it in my theme.
As i was working i found one problem. If we show full size image will break.
You need to add a new line to exit the loop when is full size.
On the function the_content, second foreach add:
if( in_array($value, array('size-full')) ) continue 2;