Skip to main content
additional information
Source Link

I'm not sure about a photo sharing service, but I have an idea of how you can track where your images are embedded with some PHP. You could probably build this in to WordPress somehow as well if you know what you're doing. I believe this could work.

In your .htaccess file put a rule something like this:

RewriteCond %{HTTP_REFERER} !^http://([-a-z0-9]+\.)?yourdomain\.com [NC]
RewriteCond %{QUERY_STRING} !^pass=1$ [NC]
RewriteRule ^(.*)\.(gif|jpe?g|png|bmp|swf)$ /hotlink.php?url=$1.$2 [R,NC,L]

This will re-write all requests for images on your site, that don't come from your domain, to a file called hotlink.php with the address for the image they were accessing contained in the 'url' variable.

Now in the hotlink.php file you can sort of do what you want. You can log the referrer and serve the image anyways, which would still allow your picture to be embedded in other sites, you can block certain sites from using your images but allow others, or you can block other sites from using your images at all.

So if all you want to do is track the referring URL's you could put something like this in your hotlink.php file that all image requests are redirected through (untested):

<?php
mysql_connect("localhost", "admin", "1admin") or die(mysql_error());
mysql_select_db("link_track") or die(mysql_error());

$query = "INSERT INTO image_tracking (img_url, date, referrer) VALUES('".$_GET["url"]."', '".date(DATE_RFC822)."', '".$_SERVER['HTTP_REFERER']."' ) ";
mysql_query($query);  

header("Location: ".$url."?pass=1");
?>

This would take the url of the image that is being accessed and record it in a MySql database with the date and the referring url. It would then serve up the image that was being requested so the people embedding your images wouldn't even notice the difference. With the information in a database you could access the info however you wanted, through a custom php page, through something like phpMyAdmin, or by adding a page to the admin area of the blog software you are currently using.

I'm not sure about a photo sharing service, but I have an idea of how you can track where your images are embedded with some PHP. You could probably build this in to WordPress somehow as well if you know what you're doing. I believe this could work.

In your .htaccess file put a rule something like this:

RewriteCond %{HTTP_REFERER} !^http://([-a-z0-9]+\.)?yourdomain\.com [NC]
RewriteRule ^(.*)\.(gif|jpe?g|png|bmp|swf)$ /hotlink.php?url=$1.$2 [R,NC,L]

This will re-write all requests for images on your site, that don't come from your domain, to a file called hotlink.php with the address for the image they were accessing contained in the 'url' variable.

Now in the hotlink.php file you can sort of do what you want. You can log the referrer and serve the image anyways, which would still allow your picture to be embedded in other sites, you can block certain sites from using your images but allow others, or you can block other sites from using your images at all.

So if all you want to do is track the referring URL's you could put something like this in your hotlink.php file that all image requests are redirected through (untested):

<?php
mysql_connect("localhost", "admin", "1admin") or die(mysql_error());
mysql_select_db("link_track") or die(mysql_error());

$query = "INSERT INTO image_tracking (img_url, date, referrer) VALUES('".$_GET["url"]."', '".date(DATE_RFC822)."', '".$_SERVER['HTTP_REFERER']."' ) ";
mysql_query($query);  

header("Location: ".$url);
?>

This would take the url of the image that is being accessed and record it in a MySql database with the date and the referring url. It would then serve up the image that was being requested so the people embedding your images wouldn't even notice the difference. With the information in a database you could access the info however you wanted, through a custom php page, through something like phpMyAdmin, or by adding a page to the admin area of the blog software you are currently using.

I'm not sure about a photo sharing service, but I have an idea of how you can track where your images are embedded with some PHP. You could probably build this in to WordPress somehow as well if you know what you're doing. I believe this could work.

In your .htaccess file put a rule something like this:

RewriteCond %{HTTP_REFERER} !^http://([-a-z0-9]+\.)?yourdomain\.com [NC]
RewriteCond %{QUERY_STRING} !^pass=1$ [NC]
RewriteRule ^(.*)\.(gif|jpe?g|png|bmp|swf)$ /hotlink.php?url=$1.$2 [R,NC,L]

This will re-write all requests for images on your site, that don't come from your domain, to a file called hotlink.php with the address for the image they were accessing contained in the 'url' variable.

Now in the hotlink.php file you can sort of do what you want. You can log the referrer and serve the image anyways, which would still allow your picture to be embedded in other sites, you can block certain sites from using your images but allow others, or you can block other sites from using your images at all.

So if all you want to do is track the referring URL's you could put something like this in your hotlink.php file that all image requests are redirected through (untested):

<?php
mysql_connect("localhost", "admin", "1admin") or die(mysql_error());
mysql_select_db("link_track") or die(mysql_error());

$query = "INSERT INTO image_tracking (img_url, date, referrer) VALUES('".$_GET["url"]."', '".date(DATE_RFC822)."', '".$_SERVER['HTTP_REFERER']."' ) ";
mysql_query($query);  

header("Location: ".$url."?pass=1");
?>

This would take the url of the image that is being accessed and record it in a MySql database with the date and the referring url. It would then serve up the image that was being requested so the people embedding your images wouldn't even notice the difference. With the information in a database you could access the info however you wanted, through a custom php page, through something like phpMyAdmin, or by adding a page to the admin area of the blog software you are currently using.

Source Link

I'm not sure about a photo sharing service, but I have an idea of how you can track where your images are embedded with some PHP. You could probably build this in to WordPress somehow as well if you know what you're doing. I believe this could work.

In your .htaccess file put a rule something like this:

RewriteCond %{HTTP_REFERER} !^http://([-a-z0-9]+\.)?yourdomain\.com [NC]
RewriteRule ^(.*)\.(gif|jpe?g|png|bmp|swf)$ /hotlink.php?url=$1.$2 [R,NC,L]

This will re-write all requests for images on your site, that don't come from your domain, to a file called hotlink.php with the address for the image they were accessing contained in the 'url' variable.

Now in the hotlink.php file you can sort of do what you want. You can log the referrer and serve the image anyways, which would still allow your picture to be embedded in other sites, you can block certain sites from using your images but allow others, or you can block other sites from using your images at all.

So if all you want to do is track the referring URL's you could put something like this in your hotlink.php file that all image requests are redirected through (untested):

<?php
mysql_connect("localhost", "admin", "1admin") or die(mysql_error());
mysql_select_db("link_track") or die(mysql_error());

$query = "INSERT INTO image_tracking (img_url, date, referrer) VALUES('".$_GET["url"]."', '".date(DATE_RFC822)."', '".$_SERVER['HTTP_REFERER']."' ) ";
mysql_query($query);  

header("Location: ".$url);
?>

This would take the url of the image that is being accessed and record it in a MySql database with the date and the referring url. It would then serve up the image that was being requested so the people embedding your images wouldn't even notice the difference. With the information in a database you could access the info however you wanted, through a custom php page, through something like phpMyAdmin, or by adding a page to the admin area of the blog software you are currently using.