X-Git-Url: https://git.sesse.net/?p=pr0n;a=blobdiff_plain;f=perl%2FSesse%2Fpr0n%2FImage.pm;h=d1743b41d5c456428e4ce78cf0a19e803f0ff065;hp=30bf73647fc4cbaee00cd970ac3f6116aaedea45;hb=fa10473159be03eb924e50cdb4688540c78f89b1;hpb=2d6536cab108c937e2af49f7dcf15f2230f44d1a diff --git a/perl/Sesse/pr0n/Image.pm b/perl/Sesse/pr0n/Image.pm index 30bf736..d1743b4 100644 --- a/perl/Sesse/pr0n/Image.pm +++ b/perl/Sesse/pr0n/Image.pm @@ -16,15 +16,21 @@ sub handler { # Find the event and file name my ($event,$filename,$xres,$yres); my $infobox = 1; - if ($r->uri =~ m#^/([a-zA-Z0-9-]+)/([a-zA-Z0-9._-]+)$#) { + if ($r->uri =~ m#^/([a-zA-Z0-9-]+)/original/(nobox/)?([a-zA-Z0-9._-]+)$#) { $event = $1; - $filename = $2; + $filename = $3; } elsif ($r->uri =~ m#^/([a-zA-Z0-9-]+)/(\d+)x(\d+)/(nobox/)?([a-zA-Z0-9._-]+)$#) { $event = $1; $filename = $5; $xres = $2; $yres = $3; $infobox = 0 if (defined($4)); + } elsif ($r->uri =~ m#^/([a-zA-Z0-9-]+)/(nobox/)?([a-zA-Z0-9._-]+)$#) { + $event = $1; + $filename = $3; + $xres = -1; + $yres = -1; + $infobox = 0 if (defined($2)); } my ($id, $dbwidth, $dbheight); @@ -40,8 +46,8 @@ sub handler { # or error($r, "Could not find $event", 404, "File not found"); # Look it up in the database - my $ref = $dbh->selectrow_hashref('SELECT id,width,height FROM images WHERE event=? AND filename=?', - undef, $event, $filename); + my $ref = $dbh->selectrow_hashref('SELECT id,width,height FROM images WHERE event=? AND vhost=? AND filename=?', + undef, $event, $r->get_server_name, $filename); error($r, "Could not find $event/$filename", 404, "File not found") unless (defined($ref)); $id = $ref->{'id'};