Some changes to gallery, upload, and created mergephps tool