Can we somehow just use the image onload event to trigger the resizing? This is avoids the need to have an arbitrary timeout... which could lead to a "flickering" or an error depending on whether the browser is very fast or very slow.