Isn't the watermark image usually going to be smaller than the image being watermarked? You have created your working image to be the watermark's size rather than the source image's size -- is that what you really want? I'm not sure about the x and y coordinates -- the larger the watermark is, the further right and (up or down?) it will be, as x and y increase with the size of the watermark. I would think about positioning it (x and y) as a function of both the image size and the watermark size.
You also have it hard coded for JPEG image and PNG watermark. You could get the image types from the file names or from the getimagesize() call ('mime' entry). Consider making it more flexible this way.