You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using height parameter and cropping I experienced some problems with the data.requestedWidth being set to nearest multiple of 160. The actual size of the image would be 800, but it's scaled down using max-width:100%; in css. This affects the height, and result in the image not filling it's static width/height container perfectly.
I solved this by adding s.defaultWidths which will be an array of the widths, and if the data.requestedWidth does not match, it use the 160 rule.
// Added custom widths
if (s.defaultWidths) {
if (s.defaultWidths.indexOf(data.requestedWidth) === -1) {
//Minimize variants for caching improvements; round up to nearest multiple of 160
data.requestedWidth = data.requestedWidth - (data.requestedWidth % 160) + 160; //Will limit to 13 variations
}
}
When using height parameter and cropping I experienced some problems with the data.requestedWidth being set to nearest multiple of 160. The actual size of the image would be 800, but it's scaled down using max-width:100%; in css. This affects the height, and result in the image not filling it's static width/height container perfectly.
I solved this by adding s.defaultWidths which will be an array of the widths, and if the data.requestedWidth does not match, it use the 160 rule.
Usage:
Didnt think about it before now, but maybe widthVariants would be better name.
The text was updated successfully, but these errors were encountered: