Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
If lazyload is used (pictureLazyloadPictures) with pictures larger than the window (example: retina resolutions, original images), the colorbox will be resized wrongly (larger than main window).
Comment | File | Size | Author |
---|---|---|---|
#10 | picture-lazyload-resizing-2412249-3.patch | 8.07 KB | Michael Dajewski |
#7 | picture-lazyload-resizing-2412249-2.patch | 7.19 KB | Michael Dajewski |
#6 | 2412249-correct-resize.patch | 5.22 KB | maen |
#1 | picture-lazyload-resizing-2412249-1-D7.patch | 2.24 KB | kjauslin |
Comments
Comment #1
kjauslin CreditAttribution: kjauslin commentedAttached patch fixes resizing. It limits the colorbox container size to the main window (respecting also the drupal colorbox maxWidth/maxHeight configuration variables).
Comment #2
attiks CreditAttribution: attiks commentedComment #3
greenSkin CreditAttribution: greenSkin commentedIt's scaling correctly, for the most part, on the first view. But subsequent views (without refresh) the images are larger than the window again. There's also a bit of a flash of the larger size before it's initially scaled down.
Appears like the 'cbox_load' event is only triggering the initial time.
Comment #4
attiks CreditAttribution: attiks commentedComment #5
johnny5th CreditAttribution: johnny5th at Encore Multimedia commentedI show this to be working after flushing server and local caches.
EDIT: I take that back. It seems that the code calling the resize isn't being fired every time the cbox comes up. Taking a crack at resolving.
Comment #6
maen CreditAttribution: maen as a volunteer commentedHere my 2 Cents for the resizing problem.
Comment #7
Michael Dajewski CreditAttribution: Michael Dajewski as a volunteer commentedI am trying to achieve simple case where, opened colorbox uses picture element so the image size can be optimised for screen size. Configuration:
Added two breakpoints:
- tablet (min-width: 768px)
- mobile (min-width: 0px)
All default settings except I did configure ‘Picture polyfill to use’ to be ‘Development polyfill’ so I I could load non-minified version of picture.js
Added two mappings:
- ‘Device mapping’ which uses ‘Device screen’ (see 4 above)
- ‘Fixed size’ which uses ‘Fixed size’ (see 4 above)
Library version: 1.6.4
- Format: Picture
- Picture mapping: ‘Fixed size’ (see 5 above)
- Colorbox picture mapping: ‘Device mapping’ (see 5 above)
I started digging in the issue and found few problems:
Attaching patch to address above problems: picture-lazyload-resizing-2412249-2.patch
Maybe there is nicer and/or cleaner way to resolve above.
We could create another issue or three issues to address all separately, but I have feeling it would only complicate the things and we would be waiting long time for resolution.
Comment #8
mmncs CreditAttribution: mmncs commented#7 Worked for me. Thanks Michael!
Comment #9
mmncs CreditAttribution: mmncs commentedI added the following so images don't expand beyond their natural width if they are smaller than screen size.
Comment #10
Michael Dajewski CreditAttribution: Michael Dajewski as a volunteer commented@mmncs thanks you.
Did not test the case.
I did found I did not set correctly image size.
We need to get interface height and width.
Adding new picture-lazyload-resizing-2412249-3.patch
Comment #11
mmncs CreditAttribution: mmncs commentedI will have a look at the new patch and test it.
I can tell you that patch #7 cut's of the bottom of the image of and doesn't work the first time fired in Firefox.
Comment #12
raywalters CreditAttribution: raywalters commentedThe 2412249-correct-resize.patch #6 worked for me by correctly resizing the colorbox. I chose this one because I was not seeing the images in carousels when clicking on them for the colorbox. This one also resized the colorbox to the window and didn't restrict the colorbox size.
Comment #13
lesleyfernandes CreditAttribution: lesleyfernandes commentedAfter 8 years, is anyone still using these patches, or need this ticket to be completed?
Comment #14
quotesBro CreditAttribution: quotesBro commented@lesleyfernandes yes, I am using #10, that worked for me.
Comment #15
steinmb CreditAttribution: steinmb at University Of Bergen commentedAfter 9y do I think we can unassign.