sub ensure_cached {
my ($r, $filename, $id, $dbwidth, $dbheight, $xres, $yres, @otherres) = @_;
- my ($new_dbwidth, $new_dbheight);
-
my $fname = get_disk_location($r, $id);
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');
}
- my $img;
- ($img, $new_dbwidth, $new_dbheight) = make_mipmap($r, $filename, $id, $dbwidth, $dbheight, $xres, $yres, @otherres);
+ my ($img, $new_dbwidth, $new_dbheight) = make_mipmap($r, $filename, $id, $dbwidth, $dbheight, $xres, $yres, @otherres);
+
+ # Update the SQL database if it doesn't contain the required info
+ if (!defined($dbwidth) && defined($new_dbwidth)) {
+ log_info($r, "Updating width/height for $id: $new_dbwidth x $new_dbheight");
+ update_image_info($r, $id, $new_dbwidth, $new_dbheight);
+ }
while (defined($xres) && defined($yres)) {
my ($nxres, $nyres) = (shift @otherres, shift @otherres);
}
}
}
-
- # Update the SQL database if it doesn't contain the required info
- if (!defined($dbwidth) && defined($new_dbwidth)) {
- log_info($r, "Updating width/height for $id: $new_dbwidth x $new_dbheight");
- update_image_info($r, $id, $new_dbwidth, $new_dbheight);
- }
return ($cachename, 'image/jpeg');
}