Expose variable allow_upscale to settings
Opened this issue · 2 comments
In /ext/media/main.php, the variable allow_upscale determines whether an image is allowed to upscale when thumbnailing (e.g. 64x64 sprite gets enlarged to 192x192). Upscaling images smaller than a thumbnail will almost inevitably result in a visible loss of quality and unnecessary filesize increase, and it's reasonable to want this disabled.
Should it be disabled by default and configurable in the setup page?
Come to think of it I wonder if there's any reason to upscale ever - I can imagine it being useful to have a minimum thumbnail size eg so that people can click on the thumbnail if somebody uploads a 1x1px image; but then I wonder if that could be done via CSS 🤔
Come to think of it I wonder if there's any reason to upscale ever
I can't think of any reason to upscale.
but then I wonder if that could be done via CSS
I believe it's best done via HTML/CSS.
The simple ways are to make either the <img> or the <a> have a height and width in CSS. But each has a problem:
- changing the <a> size works, but there's no
alt
text on hover (shows tags and other information). - changing the <img> size (and telling it not to stretch) adds the empty space inside the borders, creating a grid of squares.
To avoid either downside, we can:
- change the <a> size, and give it
title
text same as thealt
text in the <img>. (/core/basethemelet.php
) - keep the <img> alt text (it's good for SEO).
The CSS for this is:
.shm-image-list .thumb {
margin-bottom: 11px; /* I don't know why the 8px needs to become 11px when changing to grid/flex */
min-height: var(--thumb-height);
min-width: var(--thumb-width);
display: grid;
justify-items: center;
align-items: center;
}