Implement img autosizing fix #277