HashMap of attachment sizes is now built only when needed
Added logic to get image sizes from resize= query param