set max-width / max-height for random and featured image blocks
This commit is contained in:
parent
b60e8ac5b4
commit
866b77ab19
@ -77,7 +77,6 @@ function modify_url(string $url, array $changes): string
|
|||||||
return unparse_url($parts);
|
return unparse_url($parts);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Turn a relative link into an absolute one, including hostname
|
* Turn a relative link into an absolute one, including hostname
|
||||||
*/
|
*/
|
||||||
|
@ -1,5 +1,8 @@
|
|||||||
<?php declare(strict_types=1);
|
<?php declare(strict_types=1);
|
||||||
use function MicroHTML\INPUT;
|
use function MicroHTML\INPUT;
|
||||||
|
use function MicroHTML\DIV;
|
||||||
|
use function MicroHTML\A;
|
||||||
|
use function MicroHTML\IMG;
|
||||||
|
|
||||||
class FeaturedTheme extends Themelet
|
class FeaturedTheme extends Themelet
|
||||||
{
|
{
|
||||||
@ -19,16 +22,21 @@ class FeaturedTheme extends Themelet
|
|||||||
|
|
||||||
public function build_featured_html(Image $image, ?string $query=null): string
|
public function build_featured_html(Image $image, ?string $query=null): string
|
||||||
{
|
{
|
||||||
$i_id = $image->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);
|
$tsize = get_thumbnail_size($image->width, $image->height);
|
||||||
|
|
||||||
return "
|
return (string)DIV(
|
||||||
<a href='$h_view_link'>
|
["style"=>"text-align: center;"],
|
||||||
<img id='thumb_{$i_id}' title='{$h_tip}' alt='{$h_tip}' class='highlighted' style='height: {$tsize[1]}px; width: {$tsize[0]}px;' src='{$h_thumb_link}'>
|
A(
|
||||||
</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()
|
||||||
|
])
|
||||||
|
)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -17,16 +17,13 @@ class RandomImageTheme extends Themelet
|
|||||||
return (string)DIV(
|
return (string)DIV(
|
||||||
["style"=>"text-align: center;"],
|
["style"=>"text-align: center;"],
|
||||||
A(
|
A(
|
||||||
[
|
["href"=>make_link("post/view/{$image->id}", $query)],
|
||||||
"href"=>make_link("post/view/{$image->id}", $query),
|
|
||||||
"style"=>"position: relative; height: {$tsize[1]}px; width: {$tsize[0]}px;"
|
|
||||||
],
|
|
||||||
IMG([
|
IMG([
|
||||||
"id"=>"thumb_rand_{$image->id}",
|
"id"=>"thumb_rand_{$image->id}",
|
||||||
"title"=>$image->get_tooltip(),
|
"title"=>$image->get_tooltip(),
|
||||||
"alt"=>$image->get_tooltip(),
|
"alt"=>$image->get_tooltip(),
|
||||||
"class"=>'highlighted',
|
"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()
|
"src"=>$image->get_thumb_link()
|
||||||
])
|
])
|
||||||
)
|
)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user