No. You need to use Apache's mod_rewrite for this.
stymiee
He's No Good To Me Dead
3,360 posts since May 2006
Reputation Points: 161
Solved Threads: 38
You also can't stop someone probing your code to find the image link; and if they're inclined to hotlink your images; they'll probably be even more inclined to do so if they encounter lax security.
Good idea though...
I'd advise looking into some server side techniques. Quite alot of the things you've been asking about here with Javascript (cookies, redirection, dynamically generated content, referer detection [which is what you'll need for this]) are much better suited to server-side scripts and technologies.
MattEvans
Veteran Poster
1,386 posts since Jul 2006
Reputation Points: 522
Solved Threads: 64
MattEvans
Veteran Poster
1,386 posts since Jul 2006
Reputation Points: 522
Solved Threads: 64
You only need FTP access to write .htaccess files that can contain ModRewrite directives.... But they'll only work on an Apache server. Free hosting even on Apache might have all overrides disabled; which would prevent you using anything in .htaccess files.
You could probably implement an image protector using PHP... you have the same access to the server environment variables (which would let you detect who or what is accessing your images); but you'd have to do something messy like print images to the outputstream as binary data for a real protection. I did something like that a while back in Perl, it was for uploaded image validation rather than hotlink protection, but it used that principle..
You can't disable the view source button >_< Only a browser deliberately programmed with "invoke any annoying directive a web page asks me to" functionality would support that.
There are PHP image manipulation functions built into PHP.. For watermarking:
Take the basic image manipulation parts from here:
http://www.tutorialized.com/tutorial/A-Beginners-look-at-Image-Creation/11645
And combine them with the loadimagefromjpg function used here:
http://www.tutorialized.com/tutorial/Resizing-An-Image-Using-PHP/16806
MattEvans
Veteran Poster
1,386 posts since Jul 2006
Reputation Points: 522
Solved Threads: 64