Essentially I want to change a variable for image crop depending on the dimensions of each image in the gallery. If an image's height is greater than the width I want to switch to the height crop, else keep the width crop. I am using the Galleria plugin so far I have this code:
if ($(image).width() > $(image).height()){
var upordown = "width"
} else {
var upordown = "height"
}
An the variable is here and is part of the list of options for Galleria:
image_crop : upordown,
Any help would be appreciated.
Are you looking for a way to always fit the image inside the container, without cropping? Try to set
image_crop(orimageCropin the latest version) tofalse.Edit: you can listen to the
loadfinishevent and set options according to the image dimensions on the fly. You need to callrefreshImageto apply the changes.