Protect images in pop-up's

Post custom hacks and enhancements for phpwcms here only. Maybe some of these things will be included in official release later.
Post Reply
fellchen
Posts: 158
Joined: Thu 21. Jul 2005, 15:48
Location: Wesel a. Rhein, Germany
Contact:

Protect images in pop-up's

Post by fellchen »

If you want to protect your images from download you can modify the image_zoom.php in the root directory like this:

Code: Select all

<?php
require_once ('config/phpwcms/conf.inc.php');

if(!empty($_GET["show"])) {

	$img = base64_decode($_GET["show"]);
	list($img, $width_height) = explode('?', $img);
	$img = $phpwcms["content_path"]."/images/".$img;
	
	//$imginfo = getimagesize($img);

} else {
	$width_height = '';
	$img = "img/leer.gif";
}

?>
<html>
<head>
<title>preview image</title>
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo ($phpwcms["charset"]) ? $phpwcms["charset"] : "iso-8859-1" ?>">
<script language="JavaScript" type="text/javascript" src="include/inc_js/imagezoom.js"></script>
<style type="text/css">
<!--
body {
	color: #000000;
	background-color: #FFFFFF;
	padding: 0;
	margin: 0;
}
-->
</style>
</head>
<body onLoad="adjust_popup();"><table width="100%" height="100%" cellspacing="0" cellpadding="0" border="0"><tr><td background="<?php echo $img ?>" width="100%" height="100%" align="center"><a href="#" title="close this window" onClick="window.close();return false;"><img src="spacer.gif" alt="close this window" border="0" <?php echo $width_height ?>></a></td></tr></table></body>
</html>
You need the spacer.gif file in your root directory. An 1x1 px GIF image which is transparent. You can download it from here: http://www.fellchen.de/spacer.zip (zipped).

Next time when a visitor on your website try to download the image from the pop-up window, he gets the spacer.gif not more.
I know this is only a simple protection, but helpful for the most people.

Before you make any changes, you can test it here: http://www.fellchen.de/htdocs/index.php?gallery_de

°L° Marko
User avatar
pSouper
Posts: 1552
Joined: Tue 11. Nov 2003, 15:45
Location: London
Contact:

additonal use

Post by pSouper »

I would imagine it would be usefull for some to use a copyright notice or sitename image instead of the spacer image... this would give a 'watermark' effect. (make it a big so it appears nice once re-sized)
fellchen
Posts: 158
Joined: Thu 21. Jul 2005, 15:48
Location: Wesel a. Rhein, Germany
Contact:

Post by fellchen »

I have the next modification:

Code: Select all

<?php
require_once ('config/phpwcms/conf.inc.php');

if(!empty($_GET["show"])) {

	$img = base64_decode($_GET["show"]);
	list($img, $width_height) = explode('?', $img);
	$img = $phpwcms["content_path"]."/images/".$img;
	
	//$imginfo = getimagesize($img);

} else {
	$width_height = '';
	$img = "img/leer.gif";
}

?>
<html>
<head>
<title>preview image</title>
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo ($phpwcms["charset"]) ? $phpwcms["charset"] : "iso-8859-1" ?>">
<script language="JavaScript" type="text/javascript" src="include/inc_js/imagezoom.js"></script>
<style type="text/css">
<!--
body {
	color: #000000;
	background-color: #FFFFFF;
	padding: 0;
	margin: 0;
}
-->
</style>
<nolayer>
<style>
<!--
DIV#layer { position:absolute; top:48%; left:15%; z-index: 1; visibility:inherit; }
DIV#watermark { position:relative; visibility:hidden;  top:48%; left:15%; z-index:1; }
-->
</style>
</nolayer>
</head>
<body onLoad="adjust_popup();"><table width="100%" height="100%" cellspacing="0" cellpadding="0" border="0"><tr><td background="<?php echo $img ?>" width="100%" height="100%" align="center"><div id="layer"><layer id="watermark" width="431" height="29"><img src="watermark.gif" width="431" height="29" alt="" style="cursor:hand;" onClick="javascript:self.close();"></layer></div><a href="#" title="close this window" onClick="window.close();return false;"><img src="spacer.gif" alt="close this window" border="0" <?php echo $width_height ?>></a></td></tr></table></body>
</html>
Now it works with a watermark!! It's in a layer and the position is absolut so it doesn't move. The position is 48% from top and 15% from left. It's relative to the watermark image size. So the watermark is in the relative center of the portrait and landscape pictures.

The spacer.gif file is behind the watermark. The watermark is like an overlay and the real image is the background of the table cell. I mean you get a pop-up window with 3 layer.

Thx for your idea with the watermark,
°L° Marko

Test it here: http://www.fellchen.de/htdocs/index.php?gallery_de
Download of the full package: http://www.fellchen.de/spacer.zip incl. image_zoom.php + spacer.gif + watermark.gif
User avatar
pSouper
Posts: 1552
Joined: Tue 11. Nov 2003, 15:45
Location: London
Contact:

Post by pSouper »

....if you are going t get flashy withit then you may want to look at useing the GT_MOD for the water makr ;)

I think running the popup through a pre_replace may allow you to use the GT_MOD replacement tags (or cloned code from it)

jaust a thought: nice mod though & nice shoes too :OUCH:
User avatar
Kosse
Posts: 1066
Joined: Thu 9. Sep 2004, 12:08
Location: Brussels, Belgium
Contact:

Post by Kosse »

Hi fellchen, nice mod, but...

if u really want the watermark, better hack imagemagick or GD, cos if u look for 1 minute (2 right-clicks; 1) open in new tab, 2) show background-image...), you'll find the original image :cry:
3 images... watermarked, ok but...

Look at
http://www.fellchen.de/htdocs/content/i ... 02c623.jpg
http://www.fellchen.de/htdocs/content/i ... f8ca36.jpg
http://www.fellchen.de/htdocs/content/i ... c0766f.jpg

... but still works for "normal" people (meaning ...not freaks that will look at the code to get your image ;)

Cheers
fellchen
Posts: 158
Joined: Thu 21. Jul 2005, 15:48
Location: Wesel a. Rhein, Germany
Contact:

Post by fellchen »

It works!!!!! FOR THE MOST PEOPLE!!!!!

NOT FOR FREAKS!!!!!

°L° Marko

PS: In order to protect your pictures for everyone: Make no pictures = nobody can steal your pictures!
User avatar
Kosse
Posts: 1066
Joined: Thu 9. Sep 2004, 12:08
Location: Brussels, Belgium
Contact:

Post by Kosse »

fellchen wrote:It works!!!!! FOR THE MOST PEOPLE!!!!!

NOT FOR FREAKS!!!!!
No need to yell... I just thought you might know that it wasn't that "watermarked"... :oops: :roll:
fellchen wrote:In order to protect your pictures for everyone: Make no pictures = nobody can steal your pictures!
And, as I said, there are some watermark systems that apply to GD and Imagemagick, watermarking the picture itself (but I don't know how to implement them).

Don't take it personally, was trying to help...
:roll:

And I didn't read this, sorry, my bad
I know this is only a simple protection, but helpful for the most people.
Cheers
Post Reply