resize image before save it