my ($r, $id, $width, $height, $infobox, $dpr) = @_;
my $dir = POSIX::floor($id / 256);
- if ($infobox eq 'both') {
- return $Sesse::pr0n::Config::image_base . "cache/$dir/$id-$width-$height.jpg";
- } elsif ($infobox eq 'nobox') {
- return $Sesse::pr0n::Config::image_base . "cache/$dir/$id-$width-$height-nobox.jpg";
- } else {
+ if ($infobox) {
if ($dpr == 1) {
return $Sesse::pr0n::Config::image_base . "cache/$dir/$id-$width-$height-box.png";
} else {
return $Sesse::pr0n::Config::image_base . "cache/$dir/$id-$width-$height-box\@$dpr.png";
}
+ } else {
+ return $Sesse::pr0n::Config::image_base . "cache/$dir/$id-$width-$height-nobox.jpg";
}
}
# the smallest mipmap larger than the largest of them, as well as the original image
# dimensions.
sub make_mipmap {
- my ($r, $filename, $id, $dbwidth, $dbheight, $can_use_qscale, @res) = @_;
+ my ($r, $filename, $id, $dbwidth, $dbheight, @res) = @_;
my ($img, $mmimg, $width, $height);
my $physical_fname = get_disk_location($r, $id);
# If we don't know the size, we'll need to read it in anyway
if (!defined($dbwidth) || !defined($dbheight)) {
- $img = read_original_image($r, $filename, $id, $dbwidth, $dbheight, $can_use_qscale);
+ $img = read_original_image($r, $filename, $id, $dbwidth, $dbheight);
$width = $img->Get('columns');
$height = $img->Get('rows');
} else {
if (! -r $mmlocation or (-M $mmlocation > -M $physical_fname)) {
if (!defined($img)) {
if (defined($last_good_mmlocation)) {
- if ($can_use_qscale) {
- $img = Sesse::pr0n::QscaleProxy->new;
- } else {
- $img = Image::Magick->new;
- }
+ $img = Sesse::pr0n::QscaleProxy->new;
$img->Read($last_good_mmlocation);
} else {
- $img = read_original_image($r, $filename, $id, $dbwidth, $dbheight, $can_use_qscale);
+ $img = read_original_image($r, $filename, $id, $dbwidth, $dbheight);
}
}
my $cimg;
}
if ($last && !defined($img)) {
# OK, read in the smallest one
- if ($can_use_qscale) {
- $img = Sesse::pr0n::QscaleProxy->new;
- } else {
- $img = Image::Magick->new;
- }
+ $img = Sesse::pr0n::QscaleProxy->new;
my $err = $img->Read($mmlocation);
}
}
if (!defined($img)) {
- $img = read_original_image($r, $filename, $id, $dbwidth, $dbheight, $can_use_qscale);
+ $img = read_original_image($r, $filename, $id, $dbwidth, $dbheight);
$width = $img->Get('columns');
$height = $img->Get('rows');
}
}
sub read_original_image {
- my ($r, $filename, $id, $dbwidth, $dbheight, $can_use_qscale) = @_;
+ my ($r, $filename, $id, $dbwidth, $dbheight) = @_;
my $physical_fname = get_disk_location($r, $id);
# Read in the original image
my $magick;
- if ($can_use_qscale && ($filename =~ /\.jpeg$/i || $filename =~ /\.jpg$/i)) {
+ if ($filename =~ /\.jpeg$/i || $filename =~ /\.jpg$/i) {
$magick = Sesse::pr0n::QscaleProxy->new;
} else {
$magick = Image::Magick->new;
my ($new_dbwidth, $new_dbheight);
my $fname = get_disk_location($r, $id);
- if ($infobox ne 'box') {
+ if (!$infobox) {
unless (defined($xres) && (!defined($dbwidth) || !defined($dbheight) || $xres < $dbwidth || $yres < $dbheight || $xres == -1)) {
return ($fname, undef);
}
error($r, 'System is in overload mode, not doing any scaling');
}
- # If we're being asked for just the box, make a new image with just the box.
+ # If we're being asked for the box, make a new image with it.
# We don't care about @otherres since each of these images are
# already pretty cheap to generate, but we need the exact width so we can make
# one in the right size.
- if ($infobox eq 'box') {
+ if ($infobox) {
my ($img, $width, $height);
# This is slow, but should fortunately almost never happen, so don't bother
return ($cachename, 'image/png');
}
- my $can_use_qscale = 0;
- if ($infobox eq 'nobox') {
- $can_use_qscale = 1;
- }
-
my $img;
- ($img, $new_dbwidth, $new_dbheight) = make_mipmap($r, $filename, $id, $dbwidth, $dbheight, $can_use_qscale, $xres, $yres, @otherres);
+ ($img, $new_dbwidth, $new_dbheight) = make_mipmap($r, $filename, $id, $dbwidth, $dbheight, $xres, $yres, @otherres);
while (defined($xres) && defined($yres)) {
my ($nxres, $nyres) = (shift @otherres, shift @otherres);
$cimg->Resize(width=>$nwidth, height=>$nheight, filter=>$filter, 'sampling-factor'=>$sf);
}
- if (($nwidth >= 800 || $nheight >= 600 || $xres == -1) && $infobox ne 'nobox') {
- my $info = Image::ExifTool::ImageInfo($fname);
- make_infobox($cimg, $info, $r, 1);
- }
-
# Strip EXIF tags etc.
$cimg->Strip();
start => 1,
num => 250,
all => 1,
- infobox => 1,
rot => 0,
sel => 0,
fullscreen => 0,
my %settings = %defsettings;
- for my $s (qw(thumbxres thumbyres xres yres start num all infobox rot sel fullscreen model lens author)) {
+ for my $s (qw(thumbxres thumbyres xres yres start num all rot sel fullscreen model lens author)) {
my $val = $r->param($s);
if (defined($val) && $val =~ /^(\d+)$/) {
$settings{$s} = $val;
my $start = $settings{'start'};
my $num = $settings{'num'};
my $all = $settings{'all'};
- my $infobox = $settings{'infobox'} ? '' : 'nobox/';
my $rot = $settings{'rot'};
my $sel = $settings{'sel'};
my $model = $settings{'model'};
Sesse::pr0n::Templates::print_template($r, $io, "fullscreen-footer", {
returnurl => $returnurl,
start => $settings{'start'} - 1,
- sel => $settings{'sel'},
- infobox => $infobox
+ sel => $settings{'sel'}
});
} else {
Sesse::pr0n::Common::header($r, $io, "$name [$event]");
}
print_viewres($r, $io, $event, \%settings, \%defsettings);
- print_infobox($r, $io, $event, \%settings, \%defsettings);
print_selected($r, $io, $event, \%settings, \%defsettings) if ($num_selected > 0);
print_fullscreen($r, $io, $event, \%settings, \%defsettings);
print_nextprev($r, $io, $event, $where, \%settings, \%defsettings);
}
my $filename = $ref->{'filename'};
- my $uri = $infobox . $filename;
+ my $uri = $filename;
if (defined($xres) && defined($yres) && $xres != -1 && $xres != -2) {
- $uri = "${xres}x$yres/$infobox$filename";
+ $uri = "${xres}x$yres/$filename";
} elsif (defined($xres) && $xres == -1) {
- $uri = "original/$infobox$filename";
+ $uri = "original/$filename";
}
my $prefix = "";
'xres', 'yres', \@alternatives);
}
-sub print_infobox {
- my ($r, $io, $event, $settings, $defsettings) = @_;
-
- chomp (my $title = Sesse::pr0n::Templates::fetch_template($r, 'infobox'));
- chomp (my $on = Sesse::pr0n::Templates::fetch_template($r, 'infobox-on'));
- chomp (my $off = Sesse::pr0n::Templates::fetch_template($r, 'infobox-off'));
-
- $io->print(" <p>$title:\n");
-
- my %newsettings = %$settings;
-
- if ($settings->{'infobox'} == 1) {
- $io->print($on);
- } else {
- $newsettings{'infobox'} = 1;
- Sesse::pr0n::Common::print_link($io, $on, "/$event/", \%newsettings, $defsettings);
- }
-
- $io->print(' ');
-
- if ($settings->{'infobox'} == 0) {
- $io->print($off);
- } else {
- $newsettings{'infobox'} = 0;
- Sesse::pr0n::Common::print_link($io, $off, "/$event/", \%newsettings, $defsettings);
- }
-
- $io->print('</p>');
-}
-
sub print_nextprev {
my ($r, $io, $event, $where, $settings, $defsettings) = @_;
my $start = $settings->{'start'};