Fix: rotate image did not rotate all thumbnails.
Backported from master branch. Signed-off-by: Thomas Hochstein <thh@inter.net>
This commit is contained in:
parent
38a7a3f60b
commit
f55c17ee4f
@ -807,16 +807,19 @@ function serendipity_rotateImg($id, $degrees) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$infile = $outfile = $serendipity['serendipityPath'] . $serendipity['uploadPath'] . $file['path'] . $file['name'] . (empty($file['extension']) ? '' : '.' . $file['extension']);
|
$infile = $outfile = $serendipity['serendipityPath'] . $serendipity['uploadPath'] . $file['path'] . $file['name'] . (empty($file['extension']) ? '' : '.' . $file['extension']);
|
||||||
$infileThumb = $outfileThumb = $serendipity['serendipityPath'] . $serendipity['uploadPath'] . $file['path'] . $file['name'] . (!empty($file['thumbnail_name']) ? '.' . $file['thumbnail_name'] : '') . (empty($file['extension']) ? '' : '.' . $file['extension']);
|
$thumbnails = serendipity_getThumbnails($id);
|
||||||
|
|
||||||
if ($serendipity['magick'] !== true) {
|
if ($serendipity['magick'] !== true) {
|
||||||
serendipity_rotate_image_gd($infile, $outfile, $degrees);
|
serendipity_rotate_image_gd($infile, $outfile, $degrees);
|
||||||
|
foreach($thumbnails as $thumbnail) {
|
||||||
|
$infileThumb = $outfileThumb = $thumbnail;
|
||||||
serendipity_rotate_image_gd($infileThumb, $outfileThumb, $degrees);
|
serendipity_rotate_image_gd($infileThumb, $outfileThumb, $degrees);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
/* Why can't we just all agree on the rotation direction? */
|
/* Why can't we just all agree on the rotation direction? */
|
||||||
$degrees = (360 - $degrees);
|
$degrees = (360 - $degrees);
|
||||||
|
|
||||||
/* Resize main image */
|
/* rotate main image */
|
||||||
$cmd = escapeshellcmd($serendipity['convert']) . ' -rotate ' . serendipity_escapeshellarg($degrees) . ' ' . serendipity_escapeshellarg($infile) . ' ' . serendipity_escapeshellarg($outfile);
|
$cmd = escapeshellcmd($serendipity['convert']) . ' -rotate ' . serendipity_escapeshellarg($degrees) . ' ' . serendipity_escapeshellarg($infile) . ' ' . serendipity_escapeshellarg($outfile);
|
||||||
exec($cmd, $output, $result);
|
exec($cmd, $output, $result);
|
||||||
if ( $result != 0 ) {
|
if ( $result != 0 ) {
|
||||||
@ -824,13 +827,16 @@ function serendipity_rotateImg($id, $degrees) {
|
|||||||
}
|
}
|
||||||
unset($output, $result);
|
unset($output, $result);
|
||||||
|
|
||||||
/* Resize thumbnail */
|
/* rotate thumbnail */
|
||||||
|
foreach($thumbnails as $thumbnail) {
|
||||||
|
$infileThumb = $outfileThumb = $thumbnail;
|
||||||
$cmd = escapeshellcmd($serendipity['convert']) . ' -rotate ' . serendipity_escapeshellarg($degrees) . ' ' . serendipity_escapeshellarg($infileThumb) . ' ' . serendipity_escapeshellarg($outfileThumb);
|
$cmd = escapeshellcmd($serendipity['convert']) . ' -rotate ' . serendipity_escapeshellarg($degrees) . ' ' . serendipity_escapeshellarg($infileThumb) . ' ' . serendipity_escapeshellarg($outfileThumb);
|
||||||
exec($cmd, $output, $result);
|
exec($cmd, $output, $result);
|
||||||
if ( $result != 0 ) {
|
if ( $result != 0 ) {
|
||||||
echo '<span class="msg_error"><span class="icon-attention-circled" aria-hidden="true"></span> ' . sprintf(IMAGICK_EXEC_ERROR, $cmd, $output[0], $result) ."</span>\n";
|
echo '<span class="msg_error"><span class="icon-attention-circled" aria-hidden="true"></span> ' . sprintf(IMAGICK_EXEC_ERROR, $cmd, $output[0], $result) ."</span>\n";
|
||||||
}
|
}
|
||||||
unset($output, $result);
|
unset($output, $result);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user