Open discomrade opened 5 months ago
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:
alt
text on hover (shows tags and other information).To avoid either downside, we can:
title
text same as the alt
text in the \<img>. (/core/basethemelet.php
)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;
}
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?