X-Git-Url: https://git.sesse.net/?p=pr0n;a=blobdiff_plain;f=perl%2FSesse%2Fpr0n%2FRotate.pm;h=80c25521600c3c4dead844db64bb248a2ca94ac7;hp=eb8d17ebc8c386ea7f1cc746e9d410a0355dc4e6;hb=97d5bb1e417a37cf3e0cec8bf75bed3a971f913b;hpb=fd1e8cc4d43ed344438cb93e203ca146fe243487 diff --git a/perl/Sesse/pr0n/Rotate.pm b/perl/Sesse/pr0n/Rotate.pm index eb8d17e..80c2552 100644 --- a/perl/Sesse/pr0n/Rotate.pm +++ b/perl/Sesse/pr0n/Rotate.pm @@ -23,12 +23,13 @@ sub handler { { # Enable transactions and error raising temporarily - local $dbh->{AutoCommit} = 0; local $dbh->{RaiseError} = 1; my @params = $apr->param(); my $key; for $key (@params) { + local $dbh->{AutoCommit} = 0; + # Rotation if ($key =~ /^rot-(\d+)-(90|180|270)$/ && $apr->param($key) eq 'on') { my ($id, $rotval) = ($1,$2); @@ -36,8 +37,8 @@ sub handler { push @to_purge, Sesse::pr0n::Common::get_all_cache_urls($r, $dbh, $id); (my $tmpfname = $fname) =~ s/\.jpg$/-tmp.jpg/; - system("/usr/bin/jpegtran -rotate $rotval -copy all < '$fname' > '$tmpfname' && mv '$tmpfname' '$fname'") == 0 - or error($r, "Rotation of $id [/usr/bin/jpegtran -rotate $rotval -copy all < '$fname' > '$tmpfname' && mv '$tmpfname' '$fname'] failed: $!."); + system("/usr/bin/jpegtran -rotate $rotval -copy all < '$fname' > '$tmpfname' && /bin/mv '$tmpfname' '$fname'") == 0 + or error($r, "Rotation of $id [/usr/bin/jpegtran -rotate $rotval -copy all < '$fname' > '$tmpfname' && /bin/mv '$tmpfname' '$fname'] failed: $!."); $r->print("

Rotated image ID `$id' by $rotval degrees.

\n"); if ($rotval == 90 || $rotval == 270) {