commiting version 2 which is almost a rewrite. additional features include taking the padding for the images from CSS and enabling images to have borders and still be resized correctly