Arthur-Milchior / anki-resize-image

GNU General Public License v3.0
7 stars 4 forks source link

Patch: Fix string values for max-width and max-height #48

Open madmaximux opened 2 years ago

madmaximux commented 2 years ago

Config states:

*max-height/max-width: which limit to apply to image (only if previous value is set to true). Either a number, in which case it represents pixels, or a string with any valid css value. px, %.. see https://www.w3schools.com/cssref/css_units.asp

Yet config schema was not allowing for strings and the max-height/width resizing was only applying integer px values, but not strings of value-unit pairs.

Fix will allow string value-unit pairs (eg "50%") to be applied properly. In case an integer as a string (ie within quotes), it will be continue to be applied with px suffix as if it was an integer.