From edc56d3a152132b682e7574b8eec74d27cf3f93d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cduck7000=E2=80=9D?= <“ed@riethorst.net”> Date: Sun, 8 Oct 2023 19:34:05 +0200 Subject: [PATCH] cast fixed thumb creation for the fourth time .. i hope for good now --- src/Imdb/Title.php | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/Imdb/Title.php b/src/Imdb/Title.php index e99c9609..9db37f41 100755 --- a/src/Imdb/Title.php +++ b/src/Imdb/Title.php @@ -913,15 +913,13 @@ public function cast() $fullImageHeight = $edge->node->name->primaryImage->height; // calculate crop value $cropParameter = $this->thumbUrlCropParameter($fullImageWidth, $fullImageHeight, 32, 44); - $ratio = $fullImageWidth / $fullImageHeight; - if ($ratio >= 0.9) { - // Landscape (Y) - $orientation = 'SY44'; - } else { - // portrait (X) + $img = str_replace('.jpg', '', $edge->node->name->primaryImage->url); + $asFactor = $fullImageWidth / $fullImageHeight; + if ($asFactor <= 0.7) { $orientation = 'SX32'; + } else { + $orientation = 'SY44'; } - $img = str_replace('.jpg', '', $edge->node->name->primaryImage->url); $imgUrl = $img . 'QL100_' . $orientation . '_CR' . $cropParameter . ',0,32,44_AL_.jpg'; }