Skip to content

Commit

Permalink
PageImage Bugfixes & Bump Version
Browse files Browse the repository at this point in the history
  • Loading branch information
Sebastian Schendel committed Aug 3, 2024
1 parent 4bcca7b commit 35ec457
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions Twack.module.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public static function getModuleInfo() {
return [
'title' => 'Twack',
'author' => 'Sebastian Schendel',
'version' => '2.3.1',
'version' => '2.3.2',
'summary' => 'Reusable components for your ProcessWire-templates.',
'singular' => true,
'autoload' => true,
Expand Down Expand Up @@ -968,9 +968,11 @@ public static function getAjaxOf($content) {
if ($content instanceof PageImage) {
try {
$output['basename_mini'] = $content->size(600, 0)->basename;
$output['width'] = $content->width;
$output['width'] = @$content->width;
$output['height'] = $content->height;
$output['dimension_ratio'] = round($content->width / $content->height, 2);
if (is_numeric($content->width) && !empty($content->width) && is_numeric($content->height) && !empty($content->height)) {
$output['dimension_ratio'] = round($content->width / $content->height, 2);
}

if ($content->original) {
$output['original'] = [
Expand All @@ -980,9 +982,12 @@ public static function getAjaxOf($content) {
'filesizeStr' => $content->original->filesizeStr,
'ext' => $content->original->ext,
'width' => $content->original->width,
'height' => $content->original->height,
'dimension_ratio' => round($content->original->width / $content->original->height, 2)
'height' => $content->original->height
];

if (is_numeric($content->original->width) && !empty($content->original->width) && is_numeric($content->original->height) && !empty($content->original->height)) {
$output['original']['dimension_ratio'] = round($content->original->width / $content->original->height, 2);
}
}
} catch (\Exception $e) {
}
Expand Down

0 comments on commit 35ec457

Please sign in to comment.