lightcase icon indicating copy to clipboard operation
lightcase copied to clipboard

maxWidth: 1280 image is still inside a 800px box

Open al404 opened this issue 6 years ago • 9 comments

I would like to see less padding around my image With no settings the image is opened at 800px I try to add maxWidth: 1280 but doesn't seem to get bigger, I'm using a retina iMac not sure if this can influence image size

I also tried

$('a[data-rel^=lightcase]').lightcase({ maxWidth: 1280, maxHeight: 900, forceWidth: true, forceHeight: true });

but still doesn't work

al404 avatar Apr 12 '18 10:04 al404

According to your settings, it should work. How large is your image effectively (in natural)?

Btw: You don't need forceWidth/forceHeight because they only make sense in combination with the settings width/height but not maxWidth/maxHeight.

cbopp-art avatar Apr 13 '18 04:04 cbopp-art

in my case image size is 1280 x 900

I made a codepen example with real image 1920 x 1280 codepen example how I see it

al404 avatar Apr 13 '18 08:04 al404

Any fix on this? I also use the very simple way of Lightcase with a <a> tag as an image wrapper but the popup does not appears wider that 800px.

akkis avatar Jul 17 '18 13:07 akkis

Maybe it is the maxHeight which gives you the size limit. So, just try to set more maxHeight.

cbopp-art avatar Jul 17 '18 13:07 cbopp-art

I use this code:

$('a[data-rel^=lightcase]').lightcase({
  showSequenceInfo: false,
  showTitle: false,
  maxWidth: 1920,
  maxHeight: 1080
});

But I still got 800x500 as I can see with dev tools on Chrome.

akkis avatar Jul 17 '18 13:07 akkis

I found the solution. I have to use both maxWidth and maxHeight together with iframe object because I use Placehold.it service as image holder. So Lightcase thinks that I point to a URL instead of an image file so it returns an iframe, instead of an image.

akkis avatar Jul 17 '18 13:07 akkis

@akkis Ok. Another better approach in you case is to force the type image. I think it should suffice.

{
  type: 'image'
  ...
}

cbopp-art avatar Jul 17 '18 13:07 cbopp-art

Yeap, this is way better solution :) Thank you for this great library BTW.

akkis avatar Jul 17 '18 13:07 akkis

Thanks for the solution boys, i was having the same problem.

pablohenriqueop avatar Dec 10 '19 13:12 pablohenriqueop