Fantastic script, thanks!

tonywhite, by default you call it with watermark.php?src=car.jpg - see, 'SRC', not 'IMAGE'. Looks like a few other people had that problem also.

I made an upgrade to the script to better suit my needs:
I don't want to have to call the image like <img src="watermark.php?src=...."> - I would prefer to do a regular call.

So, my server setup is this:
Images get uploaded into a folder called 'upload_img'. Thumbnails are auto-generated on upload- same filename, just with a 'th_' prefix. I don't want to watermark the thumbnails. Here's what I did:

Step 1: .htaccess
RewriteEngine on
RewriteCond %{REQUEST_URI} upload_img(.*) [NC]
RewriteRule ^(.*)$$1 [NC]
This tells the server to direct any request for a file in the 'upload_img' folder through the watermark.php handler.

Step 2: ignore th_ files
Modify the php file to have an if/else statement using strpos for the filename. eg,
if (strpos contains 'th_') { 
   show raw image 
} else { 
   run the script 

Now all my existing image calls still work without needing modification. I don't need to include 'watermark.php?src=...' in my <img> tags (so users can't view source to see what i'm doing). Public users simply CANNOT access the raw image without the watermark anymore (due to the .htaccess). And it leaves my thumbnails alone.

Hope that helps someone.