I'm having a problem not being able to float images when I'm using the caption class:
This does not float:
<p><img class="caption" src="/files/u6/Andreu_roubaix.jpg" alt="Andreu at Roubaix" title="Andreu at Roubaix" width="330" height="500" style="margin: 10px; float: left;" /></p>
This does:
<p><img src="/files/u6/Andreu_roubaix.jpg" alt="Andreu at Roubaix" title="Andreu at Roubaix" width="330" height="500" style="margin: 10px; float: left;" /></p>
css is:
.caption {}
.image-caption
{
margin-top: 5px;
margin-right: 0pt;
margin-bottom: 10px;
margin-left: 5px;
background-color: #f9f9f9;
font-weight: bold;
font-size: 80%;
color: #4a4b4d;
}
.image-caption-container
{
margin-top: 10px;
margin-right: 10px;
margin-bottom: 0pt;
margin-left: 10px;
}
So it doesn't look like it's the css.
Thanks
Comments
Comment #1
awolfey commentedHere's a perfect example:
http://www.velocitynation.com/node/2204
You can see everything is floating correctly, then js puts the caption in and the float is gone.
Comment #2
danepowell commentedI am also experiencing this. This is extremely annoying... why would I want to caption an image if it's just going to sit and be ugly in the middle of the page?
Comment #3
davidwhthomas commentedPerhaps you could try floating the .image-caption-container rather than the image itself.
I tested that with Firebug on the sample link provided and it works fine.
Otherwise, try using the input format version of image caption.
DT
Comment #4
awolfey commentedYes, that would work on its own as either left or right float, but not with tinyMCE, which allows the users to apply left or right float on their own.
Comment #5
eclauset commentedI'm having the same problem -- there needs to be a way for the float to be translated from image itself to the image-caption-container
tag contains an align attribute
There's already a provision for this if the
Comment #6
awolfey commentedImage_caption looks for the align attribute, but tinymce is aligning images with float, which it puts in an inline style. Image_caption removes all inline style settings except for the align attribute. Therefore, no float
Here's my solution.
I just switched style for align in the image_caption js:
Comment #7
awolfey commentedI should add that my solution will probably break alignment using the align attribute because that needs to be applied to #image-caption-container div, and I took it out of that.
Comment #8
Anonymous (not verified) commentedIs this http://drupal.org/node/103211 related ?
Comment #9
awolfey commentedNo, this is not related to missing css.
Comment #10
ngmaloney commentedawolfey - I had the exact same problem you experienced. To resolve the "alignment" conflict I slightly modified the JS you provided and so far it seems to work. Further testing is still needed.
The following replaces the image_caption.js found within the module.
Comment #11
danepowell commentedI have applied the fix in #10 to my site and it seems to be working great. Could this get rolled into the next release?
Comment #12
Kasha commentedhahahahahah!
quit your whining, I don't see you on a list of 100 top donors, sistah.
as for the issue at hand, the above solution does not work for me.
Comment #13
Kasha commentedupon clearing my cache I'm happy to report that its working perfectly.
Comment #14
danepowell commentedPlease let us know if there's any more work that needs to be done on this. Otherwise it sounds like it can be rolled into the next release.
(Does this project have/need an active maintainer?)
Comment #15
gregarios commentedThis may be a duplicate of this issue, actually:
http://drupal.org/node/461798
Comment #16
danepowell commented@gregarios - I think these issues may be similar, but they're not duplicates. That issue seems to be related to Image Caption stripping classes, this one is related to stripping inline styles.
Comment #17
danepowell commentedIs this going to get addressed by a maintainer at all? We seem to have a fully working patch, and I'd love to get this out of my issue queue at long last (we're going on 10 months here!)
Comment #18
WeRockYourWeb.com commentedWorks great, thanks for the patch. Would also like to see this get committed.
Comment #19
danepowell commentedbump... perhaps it's time to start the "abandoned project" process
Comment #20
davidwhthomas commentedPatch applied in release 6.x-2.4 http://drupal.org/node/672928
Note: as I'm a busy developer, I depend on the community to review and test patches.
Hence, only issues marked 'tested and reviewed by the community" will be considered, thanks.
DT
Comment #21
GlobalRaj commentedThe release of 6.x-2.4 threw off the image alignment in old posts but I found the right fix.
On my site, I have given novice people the ability to add captions. I just tell them to add the following while inserting an image into any post
- width
- height
- align (was handling the float in the previous release)
- class="caption"
- title
Basically, in the previous release, the image alignment was handling the float of the image-container but the latest release replaced that with "text-align" which doesn't work as well. The following works fine for me and my old posts are also not affected.
Change Line 11 in the image_caption.js to
$(this).wrap("<div class=\"image-caption-container\" style=\"" + style + "; float: " + alignment + "\"></div>");"Easy fix!
Working example can be found at the following
http://usaca.org/content/20100107/usa-under-19-warms-down-in-2nd-match
http://usaca.org/content/20091219/university-of-minnesota-offers-cricket...
If any one is wondering how I use the borders and such, I use the following in the style.css file of my site theme
Cheers!
P.S. Am not an expert. Just trying to learn Drupal and it's awesome!!!
Comment #24
danepowell commentedSpammers on d.o? That's a new one to me. How do we report users and get posts deleted?Problem solved