I am trying to set up the Media Colorbox formatter to display my original images and let it scale them to fit the screen size. This works well with the original Colorbox formatter but I cannot get the desired behavior with this module. I am setting the "Colorbox view mode" drop-down to "Original". I have left the "Fixed Width" and "FIxed Height" fields blank. When I click on a gallery thumbnail Colorbox is displayed and takes up the entire screen space (as expected) but the image inside is not scaled down. It is instead left really "original" and scroll bars appear inside Colorbox.
How can I have the same behavior that the original Colorbox has - scale down the bigger images to fit the screen size?
Comments
Comment #1
kirilius commentedup
Comment #2
Kirk commentedI'm having the same issue. It seems that media_colorbox is not performing any calculations on the width and height attributes of the image to be displayed. As a result, the image's actual width and height are used. This is not how the normal colorbox works and I assume is not the intended behavior.
Comment #3
Chipie commentedHave you found a solution yet?
Comment #4
nodecode commentedNot sure if this is an option for everyone but I upgraded to 7.x-2.0 and it solved the problem right away. Don't forget to run update.php. There were no significant drawbacks to using the 2.0 upgrade that I could see and the database updates were error-free.
Comment #5
Chipie commentedWhat did you upgrade to 7.x-2.0? Ist here 7.x-2.0 version of Media Colorobx?
Comment #6
nodecode commentedOops sorry. I forgot to mention that I was referring to upgrading the Colorbox plugin itself. Still using 7.x-1.0-rc3 of Media Colorbox.
Comment #7
robertom commentedI use:
Colorbox 7.x-2.0+2-dev
File entity 7.x-2.0-unstable7+3-dev
Media Colorbox 7.x-1.0-rc3
and the problem still exists
Comment #8
siretfeL commented...it seems like we only have options to load images in original size not automatically resized as in usual colorbox or in preset image styles. Problem (;) remains with latest colorbox plugin and module (7.x-2.3). Could it be a configuration issue?
Comment #9
magic_al commentedSame here. Same configuration like #7.
Comment #10
magic_al commentedAlright, the thing is the Module looks at an image not as an image but rather as an file while the actual colorbox deals with an image in a slightly other way.
In case of the scaling problem the plugin just can't recognize the image as an image. It tries to check it:
settings.photoRegex.test(url)checks weather the reference ('href') of the link handed over to the plugin is an image or not. As the Module does not link to the image but to a Html document containing the image the argument is evaluated false.As for the settings.photo variable: According to http://www.jacklmoore.com/colorbox/, the 'photo' setting is applyable in case that the URL of the image is evaluated false but still as an image. For example .../image.php would be evaluated to not be an image. In the present case the URL is not a image at all so this property dosn't help us.
Comment #11
magic_al commentedThat works for me:
One has to adjust the image output. That means in case of an image the link is supposed to reference the real image instead of the file entity. I created a small module as follows:
Hope it helps someone.
Comment #12
suldan commentedThe parent has the correct width, so just force the image to stay inside. Maybe like:
Edit: But then we probably get trouble with some crazy markups floating around ( #cboxTopLeft, #cboxTopRight, etc.) they are building the frame. Solution: don't use them.
Comment #13
andrey_sunday commentedThe problem solved. Look at http://drupalcode.org/project/media_colorbox.git/commitdiff/7a45582bf61e...
Comment #14
greg boggsThanks Andrey!
I assumed the commit fixed this too, but I haven't had a chance to test it directly yet. Did you test my commit to make sure this bug is fixed? Feel free to update ticket status if you see any issues with the wrong status.
Comment #15
andrey_sunday commentedYes, I tested your commit. Everything works fine. Thank you for the wonderful module.
Comment #16
suldan commentedAwesome! Ty for the commit!
Comment #17
andrey_sunday commentedUse media colorbox 7.x-1.0-rc4