Fit an image perfectly in html() dimensions?
Posted: 10 Oct 2021 21:57
I have an animated.gif that I want to preview via the inbuilt
Does anybody know how to put that inside the html code so that I don't need arbitrary values for
Ofc the scrollbars must be hidden...
html() commandDoes anybody know how to put that inside the html code so that I don't need arbitrary values for
html() width and height?Ofc the scrollbars must be hidden...
Code: Select all
$dims = property("#image.dimensions", <curitem>);
$width = gettoken($dims, 1, " x ", "t");
$height = gettoken($dims, 2, " x ", "t");
$src = replace(<curitem>, "\", "/");
$file = gpc(<curitem>, "file");
// CSS styles
$cssStyles = <<<>>>
body {
overflow: hidden;
}
>>>;
$html = <<<>>>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<style>
$cssStyles
</style>
</head>
<title></title>
<body>
<div style="position:absolute;left:0px;top:0px">
<img src="$src" alt="$file" width="$width" height="$height"></img>
</div>
</body>
</html>
>>>;
html($html, $width + 40, $height + 100, self("base"));