shish / shimmie2

An easy-to-install community image gallery (aka booru)
http://code.shishnet.org/shimmie2/
GNU General Public License v2.0
404 stars 113 forks source link

Expose variable allow_upscale to settings #1142

Open discomrade opened 5 months ago

discomrade commented 5 months ago

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?

shish commented 4 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 🤔

discomrade commented 4 months ago

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:

To avoid either downside, we can:

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;
}