The function is fine as is.
Code:
Content visible to verified customers only.
There are two variables passed in the case of editing a photo because if you replace the photo we need to actually reprocess it. Its just an extra variable whereas in upload.php we only need to pass one variable as its a new photo period.