Darkstar Posted December 26, 2007 Share Posted December 26, 2007 Let me start at the beginning. Somebody wanted me to code their website and it's a photography site so I wanted to disallow image downloads for obvious reasons. I was going to use a few tricks to accomplish this. I would overlay a transparent image over the actual image so that if somebody right clicks and hits save as they don't get the image. If they're smart enough to view source they'd see the following: <img src="nodownload.php?image=image.jpg"> nodownload.php checks to see if it's being called from in a page on a certain domain, if it is it'll use gd, grab the image and display it. If the page is being hotlinked or no HTTP_REFERER then it'll watermark the picture with GD then output it. This works fine on firefox because firefox isn't caching the output of the php page so if they right type the url of the image it runs through the script again. IE on the other hand is caching the output and displaying the picture it displayed when called from the <img> tag which defeats the purpose of having the code at all if it's going to get cached. I need a way to force all browsers to run the script (not the containing page) instead of caching it. Thoughts? If not, is there a better way or doing this other than mod_rewrite? If it comes down to it I guess I could simply use mod_rewrite to redirect to an error page. Quote Link to comment https://forums.phpfreaks.com/topic/83248-solved-ie-caches-php-output-workaround/ Share on other sites More sharing options...
PHP_PhREEEk Posted December 26, 2007 Share Posted December 26, 2007 Doesn't really matter either way... If you don't want images stolen, then a huge watermark should be on each image (large or small, or in between). If there's a way to load an image through a normal click and view it (not right-clicking it), then I can just hit ALT-PRINT_SCREEN, and I now have the picture in my clipboard. I can paste it right into Photoshop or any other graphics program and save it. No need to be 'smart enough to view the source' if I'm viewing it right on my monitor... PhREEEk Quote Link to comment https://forums.phpfreaks.com/topic/83248-solved-ie-caches-php-output-workaround/#findComment-423467 Share on other sites More sharing options...
Darkstar Posted December 26, 2007 Author Share Posted December 26, 2007 although true, most people wouldn't go through the trouble although you're right, I should watermark them regardless. I just wanted it to be at least a little friendly if you were looking at the pictures on the site. I know that I hate going to sites and seeing watermarks on images that are simply being displayed in the page. Maybe the solution i'm looking for is smaller thumbnails that link to a watermarked, larger image. Quote Link to comment https://forums.phpfreaks.com/topic/83248-solved-ie-caches-php-output-workaround/#findComment-423469 Share on other sites More sharing options...
BK87 Posted December 26, 2007 Share Posted December 26, 2007 add a randomizer at the end... <img src="nodownload.php?image=image.jpg&rand=<?= rand(0,99999); ?>"> or something like that Quote Link to comment https://forums.phpfreaks.com/topic/83248-solved-ie-caches-php-output-workaround/#findComment-423474 Share on other sites More sharing options...
Darkstar Posted December 26, 2007 Author Share Posted December 26, 2007 that wouldn't solve it, unfortunately. The number would be appended but if you copy the URL and type it in the addressbar in IE it'll be cached because the randomizer won't change from the img src to the time it's loaded by itself. That would work if I needed it displayed differently on 2 pages but not if it's being called by itself. Quote Link to comment https://forums.phpfreaks.com/topic/83248-solved-ie-caches-php-output-workaround/#findComment-423476 Share on other sites More sharing options...
PHP_PhREEEk Posted December 26, 2007 Share Posted December 26, 2007 >most people wouldn't go through the trouble That's contradictory if you are saying they will go through the trouble of checking the source and trying to directly download the image (which is why you need this to begin with), but not simply pressing ALT-PRINT SCREEN. If a watermak is done correctly, then it should not interfere with the viewing of the photo, yet totally protect it at the same time. All I'm saying is, you are building a custom script and spending time doing something that isn't going to provide any real protection. If your customer is paying to create this non-protection, then they are going to get ripped off, and probably pissed off. If you are doing it for free, you are wasting your time and will still endup with a pissed off client. You have to be honest with them about how it works... scripts can't protect everything. Get a proper watermark system in place, and drop the script idea. PhREEEk Quote Link to comment https://forums.phpfreaks.com/topic/83248-solved-ie-caches-php-output-workaround/#findComment-423477 Share on other sites More sharing options...
Darkstar Posted December 26, 2007 Author Share Posted December 26, 2007 Basically what I want to avoid is what you hit on, an obtrusive watermark that takes away from the experience of viewing the images. What I also don't want to have to do is open up photoshop for every image and manually watermark it because that'll take a considerable amount of time. So let me run this past you: I was originally going to use a script to add all new photos to the database and then prompt you for categories it would show up in. I figure I can make the the watermark part of this process and prompt me for where (in coordinates) to put it so it looks unobtrusive. Quote Link to comment https://forums.phpfreaks.com/topic/83248-solved-ie-caches-php-output-workaround/#findComment-423496 Share on other sites More sharing options...
PHP_PhREEEk Posted December 26, 2007 Share Posted December 26, 2007 You should be able to overlay some sort of watermark using PHP's imaging commands, but that's not my forte, so I'd mark this as 'solved' and post a new question with the proper title. There are some folks around here that are very strong in the PHP image dept. Best of luck! PhREEEk Quote Link to comment https://forums.phpfreaks.com/topic/83248-solved-ie-caches-php-output-workaround/#findComment-423515 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.