I just want to share an issue with Zen theme and a possible solution.
In Zen theme's normalize.css
(or *.scss, line 461) file, max-width
is set to 100%
for the <img>
tags. This messes up the preview and cropbox images (in div.imagefield-crop-preview
and div.imagefield-crop-cropbox
) in ImageField Crop's "Image cropped" field type, because these images get distorted, as you can see here:
Possible solution (this must be placed in a file which appears later in the source code than normalize.css
!):
/* Zen - max-width: 100% for img tags in normalize.css messes up ImageField Crop's preview and cropbox -
we have to set max-width to none to fix it */
/* inner wrappers: div.imagefield-crop-preview, div.imagefield-crop-cropbox */
div.imagefield-crop-widget img {
max-width:none;
}
AFTER the setting, the preview and cropbox images look fine:
I hope it saves some minutes for others using this module and Zen theme.
(And sorry for posting it as an "issue", but this way it can be found here, related to the module.)
Comments
Comment #2
Bastlynn CreditAttribution: Bastlynn commentedThis hit me as well and I was lucky enough to find it in the archives.
I've got a patch for this against 7.x-1.x - see attached.
Comment #3
Bastlynn CreditAttribution: Bastlynn commentedComment #4
Bastlynn CreditAttribution: Bastlynn commentedAnd for 7.x-2.x
Comment #5
pkiff CreditAttribution: pkiff commentedThanks for the patches Bastlynn, and for re-opening this issue to bring it back up the queue.
I'm running 7.x-1.x, using a sub-theme based on Omega 4, and I ran into this distorted image issue as well. So this problem may be a generalized issue with any theme that uses normalize.css, in which case, there may be a need for a more generalized patch that does not require checking for the presence of a Zen theme.
Comment #6
briandev CreditAttribution: briandev commentedTo add to pkiff's comment - I noticed this issue on the Twitter Bootstrap theme. Added the CSS posted by Sk8erPeter and problem solved.
Comment #7
tonyoh CreditAttribution: tonyoh commentedThis is amazing!
This has been haunting me for an absolute age - every crop module - exact same thing on IE10.
Thank you.
Comment #8
Bastlynn CreditAttribution: Bastlynn commentedBased on it hitting multiple themes, maybe we shouldn't bother checking at all and just add CSS to correct regardless of enabled theme?
Comment #9
MHz CreditAttribution: MHz commentedI put the css from #8 in jquery.Jcrop.css and that fixed it for me. Thanks Bastlynn.
Comment #10
steveOR CreditAttribution: steveOR commentedI am using Ember theme for admin pages and this same issue is coming up. Not sure of the best approach... sub-theme Ember and fix there? Just going back to Seven admin theme for now since that works.
Comment #11
bserem CreditAttribution: bserem commentedThis also happens to a theme a designer made that is not based on a base-theme (I know...).
I also agree with Bastlynn (#8).
Scaling this to normal, as it makes the module seem broken for many many themes.
Comment #12
bserem CreditAttribution: bserem commentedAttempt for a patch against 7.x-1.x
Comment #13
Bastlynn CreditAttribution: Bastlynn commentedOk, new patch :) This one adds a toggle in the theme administration to turn the css include on or off for those themes out there that don't have issues with this field.
This one for 7.x-1.x
Comment #14
Bastlynn CreditAttribution: Bastlynn commentedAnd againsts 7.x-2.x
Comment #15
Bastlynn CreditAttribution: Bastlynn commentedKicking back over to review state
Comment #16
Bastlynn CreditAttribution: Bastlynn commentedBumpity.
There's a LOT of issues in the queue that look like they could be addressed with this. Anything with a 'My image is distorted / not saving / wrong area' could be because of this root cause unless otherwise ruled out from their theme.
Is this something I need to reroll against dev branches for merging or?
Comment #18
Bastlynn CreditAttribution: Bastlynn commentedThanks! :)
Comment #20
315redad CreditAttribution: 315redad commentedthank you so much, save a lot of time!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Comment #21
j4 CreditAttribution: j4 as a volunteer commentedHI, Has this commit been pushed to the version 7.2 also?
Thanks!
Comment #22
qqboy CreditAttribution: qqboy commented#8 nice
but this
div.imagefield-crop-widget img {
max-width:none !important;
max-height:none !important;
}