Added image resizing code