CodeCharge Studio
search Register Login  

Web Reports

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> Archive -> GotoCode Archive

 Anti-Leech of images

Print topic Send  topic

Author Message
RipCurl
Posted: 06/05/2003, 6:31 PM

Using PHP + Templates, CodeCharge (not studio) and MySQL

Does anyone have a code they can use to stop people from LEECHING images from your website?

I have the image file name stored in the DB (mysql)
and have this in the Custom show for that field:

if ($fldimg!=null) {
$tmpfile2 = "screen/".$fldimg;
$fldimg = $tmpfile2;
}
else {
$fldimg="No image";
}

Is there a way so that we can prevent leeching?
glerma
Posted: 06/05/2003, 7:35 PM

What are you looking for. Client side (Javascript) or Server-side (PHP)?
RipCurl
Posted: 06/05/2003, 7:48 PM

Php. JavaSCript can be disabled through browser, so in essence, nullifying it.
glerma
Posted: 06/05/2003, 8:21 PM

Yeah. I know the Javascript option is not a good one. That's why I asked.

Maybe the problem should be addressed at the server-level. Meaning your webserver using throttling techiques. Apache has mod_throttle to address these very issues.

Check out this article. See if maybe it might help you in your efforts. (Assuming you use Apache 1.3x!)
http://www.snert.com/Software/mod_throttle/

Take not in particular the following passage from the article:
Document
Excluding requests for HTML page elements such as images and style sheets, impose a limit on the number of requests per period. When this limit is exceeded all further requests are refused, until the elapsed time exceeds the period length, at which point the elapsed time and the counters are reset. Note that the requests (hits) column of the throttle status display does not include the requests for page elements.

Idle
mutsch
Posted: 06/06/2003, 1:52 AM

I am not sure what you are trying to do. Do you wanna prevent people from stealing images from your site?

If this is what you wanna do it is possible but there are certain drawback with each solution.
There are certain viewers available on the net that display images and don't allow any save or even screen scraping on a very low level. Nevertheless all these solutions require the download of some code that does the rendering of images instead of the browser. Problem here is cross browser compatibility and download time.
I would recommend that you watermark all your images if are just wanna do it for let's say catalog pictures. If you wanna do it for all image assets on your side I would say forget about. It's not practical. I hope this is what you asked for. If not, forget about it.

mutsch
StevenD
Posted: 06/06/2003, 2:04 AM

Instead of beating your head trying to 'stop' the stealing of images,

why not make it a hassle for people if they do such a thing

if you extracted your images each into its own timestamp named sub-directory
you could name 'every' image the same name www-mywebsite-com.jpg and leave the person stealing a headache , having to rename everything and search all

/*timestamp*/ directories for needed images.

other than that

if your using apache or other configurable server, you could set a 'home made' .dot extension to be displayed to browsers as Image/JPG , so that the displayed images all showed as normal but were all named

/*timestamp*/www-mywebsite-com.xyz

in which case, you may find that if you pick a unique extension, most stealing programs might pass the jpg file if set to grab .jpg .gif .png ?

general public, right clicking and downloading your images would soon get fed up of altering all the same www-mywebsite-com.xyz filenames.

other than making things Awkward, i do not think you can ever stop image being stolen

Steven Dowd
feha
Posted: 06/06/2003, 4:42 AM

With the script You are retriving images from MySQL (if they are stored in mySQL...)

Put the code to check the referer if referer is outside of your server than redirect to another image with displaying "NO LEECH" ...
check via HTTP_REFERER variable


regards
feha
[www.vision.to]



RipCurl
Posted: 06/06/2003, 12:53 PM



Okay to clarify:

1. The file names are stored inthe Mysql db (i wont be storing any images in the DB because i have nearly 32,000 images average 400 kb - 1 meg each, and that would be ONE HUGE db.)
2. The images are stored in several directories, because they are categorized as such.
3. Anti-leech is only preventing them from "linking to" the image, instead of downloading it and putting it on their own webspace. I could care less if they take the image, I just dont want them stealing my bandwidth.
4. Currently on the "image field" in CC, I have the following code for the Custom show:
if ($fldimg!=null) {
$tmpfile2 = "screen/".$fldimg;
$fldimg = $tmpfile2;
}
else {
$fldimg="No image";
}

Screen being one directory that some of the images are stored in.
$fldimg - is the field name for it to show my image.

5. Anti-leech as well as they dont plug http://www.mydomain.com/screen/imagefile.jpg into a browser as well. They must be or have to be redirected to the main page, and only through a "certain" link allowed to see the url http://www.mydomain.com/screen/imagefile.jpg (so following http referrer i believe)
feha
Posted: 06/08/2003, 2:57 AM

I understand now what is the problem about ...
Some hostings allows you to setup this feature via CPANEL (the contol panel)
You can set there and put file types that you want not to be linked ...

Another solution is:
1) You have to put all images in non-public directory on your server.
2) The code/script which parses images to the browser.
This script will have to check HTTP_REFERER ...

feha
[www.vision.to]
feha
Posted: 06/08/2003, 3:22 AM

check this link
http://www.evilwalrus.com/viewcode.php?codeEx=699


feha
feha
Posted: 06/08/2003, 3:24 AM

This one too

http://www.evilwalrus.com/viewcode.php?codeEx=263



regards
feha
[www.vision.to]
RipCurl
Posted: 06/10/2003, 12:57 PM

from your first link feha

<img src="someimage.png?x=<?=uniqid((double)microtime()*1000000,1)?>">

What does this do?
feha
Posted: 06/10/2003, 2:59 PM

I'm not the author of that code but I supose it add's the time extenssion to the image calling...
it is in real time of your server side so that the links to your image file won't work becuse that variable will change all the time ...


regards
feha
EMG
Posted: 06/10/2003, 7:54 PM

If you make it available on the web without authentication or controlled authorization, it is fair game in my mind. There will always be ways to get images off a page.
RipCurl
Posted: 06/11/2003, 1:19 PM

I just dont want people STEALING my bandwidth by directly linking to it (that is what Anti-leeching means)


If i dont want people to steal my images, I'd only have a text based website.

RipCurl
Posted: 06/11/2003, 1:23 PM

"I'm not the author of that code but I supose it add's the time extenssion to the image calling...
it is in real time of your server side so that the links to your image file won't work becuse that variable will change all the time ..."



But how would that affect someone from "directly" linking to my images?

Using that code with this one?


if ($fldimg!=null) {
$tmpfile2 = "screen/".$fldimg;
$fldimg = $tmpfile2;
}
else {
$fldimg="No image";
}

if ($fldimg_th!=null) {
$tmpfile = "screen/".$fldimg_th;
$fldimg_th = "<a href=$tmpfile2><img src=$tmpfile width=150 height=100 border=0></a>";
}
else {
$fldimg="No image";
}
feha
Posted: 06/11/2003, 1:46 PM

I would preffer you this one ...
http://www.evilwalrus.com/viewcode.php?codeEx=263
[take that code and put it on the file image.php ]

call your images as ...

if ($fldimg!=null) {
$tmpfile2 = "image.php?img=imagename".$fldimg;
$fldimg = $tmpfile2;
}
else {
$fldimg="No image";
}


Hope this helps ...

regards
feha
[www.vision.to]

   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

PHP Reports

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.