GdMediaHandler.php: correct rotation to anticlockwise degrees

This commit is contained in:
Zankaria 2025-03-25 11:02:05 +01:00
parent 83bf65e9be
commit dbcb1b5bef

View file

@ -168,7 +168,7 @@ class GdMediaHandler implements MediaHandler {
if ($degrees !== 0) { if ($degrees !== 0) {
self::enableTransparency($gd, $file_mime); self::enableTransparency($gd, $file_mime);
$gd_other = \imagerotate($gd, $degrees, \imagecolorallocatealpha($gd, 0, 0, 0, 127)); $gd_other = \imagerotate($gd, 360 - $degrees, \imagecolorallocatealpha($gd, 0, 0, 0, 127));
\imagedestroy($gd); \imagedestroy($gd);
if ($gd_other === false) { if ($gd_other === false) {
throw new \RuntimeException("Error while correcting rotation of '$file_path'"); throw new \RuntimeException("Error while correcting rotation of '$file_path'");