View Single Post
Old 05-02-2007, 03:12 PM  
donborno
Confirmed User
 
Join Date: Jan 2007
Location: Vienna, Austria
Posts: 374
If it's just about one image, here's my Perl quick'n'dirty solution:

Quote:
#!/usr/bin/perl -w
use strict;
use warnings;
use CGI;
use FindBin '$Bin';

# Config ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~

# chmod this file to 0666
our $LOG = $Bin . 'iplog.txt';
our $IMAGE_URL = 'http blabla com/image.jpg';

# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~

my $query = new CGI;

# Create log entry
open(my $fh, '>>', $LOG) or die "Cannot open $LOG for writing: $!";
print $fh $query->remote_host(), "\n";
close($fh) or die "Cannot close $LOG after writing: $!";

# Print redirection header
print $query->redirect($IMAGE_URL);
Save that file as /cgi-bin/my_image.pl, chmod it 755 and use mod_rewrite, e.g.
Quote:
RewriteEngine on
RewriteRule /some_dir/image.jpg /cgi-bin/my_image.pl
In your HTML file, simply use
Quote:
<img src="/some_dir/image.jpg" alt="Some slut" title="" />

Last edited by donborno; 05-02-2007 at 03:14 PM..
donborno is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook