Search code examples
javascriptjqueryclient-sidegalleria

Turn off scaling in Galleria


When Galleria is in fullscreen mode, I want it to display images pixel-for-pixel, i.e. with no scaling at all.

My initial plan was to do this by both:

  • using fullscreenCrop: false, because the docs say that, "false will scale down so the entire image fits", and
  • ensuring (I already have a mechanism for doing this) that the "big" image file's:
    • height (px) ≦ the screen's height (px) and
    • width (px) ≦ the screen's width (px).

Unfortunately:

  • the docs neglect to note that "false will also scale up so the entire image fits" (i.e. if both the image's height (px) < the screen's height (px) and the image's width (px) < the screen's width (px)), and
  • I do not have, nor do I want to have, a mechanism for ensuring that the "big" image file's
    • height (px) = the screen's height (px) or
    • width (px) = the screen's width (px).

Given all this, please can you suggest how I might achieve my objective?


Solution

  • You can prevent scaling by adding these two options:

    maxScaleRatio: 1
    minScaleRatio: 1
    

    You probably only need the first one to prevent upscale. But the second one prevents downscale as well. Read more: http://galleria.io/docs/options/maxScaleRatio/