looks fine to me, a few points, though:
1) Instead of getting the db through the galleryimage_handler, just go $xoopsDB
2) If you are getting all your variables from POST, you don't need the queryF, but just normal query. If, on the other hand, you do have oldname and newname in GET statements (which I wouldn't recommend) queryF is the correct one to use
Good luck