From 866b77ab196cd28733f5606aa9d79a0a1ee54d30 Mon Sep 17 00:00:00 2001 From: Shish Date: Sat, 28 Mar 2020 00:23:29 +0000 Subject: [PATCH] set max-width / max-height for random and featured image blocks --- core/urls.php | 1 - ext/featured/theme.php | 26 +++++++++++++++++--------- ext/random_image/theme.php | 7 ++----- 3 files changed, 19 insertions(+), 15 deletions(-) diff --git a/core/urls.php b/core/urls.php index f4b1b721..3f35ebf7 100644 --- a/core/urls.php +++ b/core/urls.php @@ -77,7 +77,6 @@ function modify_url(string $url, array $changes): string return unparse_url($parts); } - /** * Turn a relative link into an absolute one, including hostname */ diff --git a/ext/featured/theme.php b/ext/featured/theme.php index ee797c1e..d82c1a32 100644 --- a/ext/featured/theme.php +++ b/ext/featured/theme.php @@ -1,5 +1,8 @@ id; - $h_view_link = make_link("post/view/$i_id", $query); - $h_thumb_link = $image->get_thumb_link(); - $h_tip = html_escape($image->get_tooltip()); $tsize = get_thumbnail_size($image->width, $image->height); - return " - - {$h_tip} - - "; + return (string)DIV( + ["style"=>"text-align: center;"], + A( + ["href"=>make_link("post/view/{$image->id}", $query)], + IMG([ + "id"=>"thumb_rand_{$image->id}", + "title"=>$image->get_tooltip(), + "alt"=>$image->get_tooltip(), + "class"=>'highlighted', + "style"=>"max-height: {$tsize[1]}px; max-width: 100%;", + "src"=>$image->get_thumb_link() + ]) + ) + ); } } diff --git a/ext/random_image/theme.php b/ext/random_image/theme.php index 7e4702ab..dc17d0af 100644 --- a/ext/random_image/theme.php +++ b/ext/random_image/theme.php @@ -17,16 +17,13 @@ class RandomImageTheme extends Themelet return (string)DIV( ["style"=>"text-align: center;"], A( - [ - "href"=>make_link("post/view/{$image->id}", $query), - "style"=>"position: relative; height: {$tsize[1]}px; width: {$tsize[0]}px;" - ], + ["href"=>make_link("post/view/{$image->id}", $query)], IMG([ "id"=>"thumb_rand_{$image->id}", "title"=>$image->get_tooltip(), "alt"=>$image->get_tooltip(), "class"=>'highlighted', - "style"=>"height: {$tsize[1]}px; width: {$tsize[0]}px;", + "style"=>"max-height: {$tsize[1]}px; max-width: 100%;", "src"=>$image->get_thumb_link() ]) )