stable isn't something that we really can gamble with. With 64,000 images and 320,000 comments, we really can't install a beta.
562 and 6 adm-photo and editphoto files and make sure this type of code is in those two files. I use a program called beyond compare from scootersoftware.com to compare two files and see the difference. You only want to be concerned with this block.
If they are not the same, should they be changed so that they are?
I am confused though, as you stated in the first post it was an issue with the database, but now you are requesting I look at templates. Is this trouble shooting to see where the problem is at; ie: database vs. template?