This is an img tag loader that resizes the image to fix into a square area, using CSS to provide padding on the sides to keep the original aspect ratio. This solves the problem of using an tag with a square width/height
Use like
squareImg("http://url/to/image", 128, "#000000", function(i) { /* image loaded into DOM node i, ready to insert into my own DOM */ });