reset the size of a photo if it is large than the outer box