Perhaps the best way is joining the files before sending them to the client. This way you can show thumbnails without watermark, yet the big image has it. This method is not very fast, cause the server will have to do this every time a picture is shown, but you will alway have the original image, and wilil be able easily to change the watermark