Captioning images
-
I’ve been digging around, including searching the WP doc to add caption to photos in a simple way, and either what I want is too complicated, or I’m just not looking at it the right way.
On a collaborative blog, I’m trying to find a simple way for contributors to add photos simply. The photos will:
a) be aligned either left, right or center;
b) be in various sizes,
c) have captions that include photo credit, descriptive text (with styling, mostly italic) and, at times, hyperlinks.From that, you know I cannot use the couple of existing plugins that either pull the alt tag text (it’s not it’s purpose to be a caption anyways) or the title text from the img tag. So I tackled this from the CSS side of things. I have managed to create a couple of CSS div tags and formatting that ‘almost’ achieves what I’m looking for, but not quite. Here’s how it goes so far:
/* Begin Images */ .posttext .imagecenter { display: block; padding: 0px 5px 5px 5px; display: inline; } img.aligncenter { display: block; margin-left: auto; margin-right: auto; margin-top: 15px; margin-bottom: 2px; } .captioncenter { margin-left: auto; margin-right: auto; padding: 4px 3px 0px 3px; font-size:0.7em; line-height: 1em; color: black; width: 250px; } .posttext .imageright { float: right; padding: 15px 10px 5px 10px; display: inline; } .posttext .imageright { float: right; padding: 15px 10px 5px 10px; } img.alignright { display: inline; padding: 4px; margin: 0 0 2px 7px; } .captionright { margin: 0 0 2px 7px; padding: 4px 3px 0px 6px; font-size:0.7em; line-height: 1em; color: black; width: 250px; } .posttext .imageleft { float: left; padding: 4px; margin: 15px 10px 2px 10px; display: inline; } img.alignleft { display: inline;padding: 4px; margin: 0 7px 2px 0; } .captionleft { margin: 0px 7px 2px 0px; padding: 4px 3px 0px 3px; font-size:0.7em; line-height: 1em; color: black; width: 250px; } /* End Images */
Using that, posters only need to use the uploading tool of WP 2.5 and select the positioning they want from the tool. Then, they simply add the imageleft, imageright or imagecenter div, as well as another div within for the caption. So, within the text editing window, it looks something like this:
<div class="imageleft"><img src="https://blahblah.com/wp-content/uploads/2008/03/image.jpg" alt="Image" title="The Image" width="250" height="173" class="alignleft" /><br /><div class="captionleft"><strong>Photo:</strong> Photographer<br />Whatever caption text you want, including hyperlinks if needed.</div></div>And then the regular text...
It seems to work just fine, with one limitation: it always ends up putting the image aligned with a new paragraph (or between them for the center alignment) because the div automatically causes a paragraph break.
Does anyone have ideas or suggestions to improve/fix/change this to have more flexibility?
- The topic ‘Captioning images’ is closed to new replies.