imprelment method to auto resize image