Additional tag for the image description

luebbe - September 20, 2007 - 14:25
Project:Image filter
Version:5.x-1.0
Component:Code
Category:feature request
Priority:normal
Assigned:Unassigned
Status:needs review
Description

Currently image filter only pulls out the node title and uses it as the alt= text.

My first wish is to use the node title also as the image title (easy enough)
My second wish is to put the image into a div and add a tag like [desc=0|1] to image filter. This tag pulls out the image description and adds it to the image div.

The result of [image:nn size=portrait class=alignleft desc=1] could be something like

<div>
<a href="xxx"><img src="peterpaul.png" width="320" height="240" alt="Peter & Paul" title="Peter & Paul" class="alignleft" /></a><br />
This is a picture of Peter & Paul taken at the sea.
</div>

#1

luebbe - September 20, 2007 - 14:27

PS: I already submitted a patch for this about a year ago in http://drupal.org/node/35821

#2

raintonr - October 23, 2007 - 00:38

I like this too, but desc=0|1 is a bit unfriendly. I think it should be more like caption=teaser|full|"My caption".

Also, the caption when derived from teaser or the given text should be placed inside it's own <div> so as to allow the theme to place it nicely with the image. This would depend on the code placing everything inside a class rather than putting it on the <img...> tag only as now. The example becomes:

<div class="alignleft">
<a href="xxx"><img src="peterpaul.png" width="320" height="240" alt="Peter & Paul" title="Peter & Paul"/></a>
<div class="caption">This is a picture of Peter & Paul taken at the sea.</div>
</div>

#3

raintonr - October 24, 2007 - 01:29
Status:active» needs review

Here's a patch for the aforementioned idea of caption=(teaser|body|"My Caption").

Nice effects are possible with use of CSS, but have a slight problem trying to get a caption to appear to the right of a thumbnail (float the image to the left). The image appears to break out of the bounding image_caption div when using this:

.image_caption {
  border: 1px solid #ddd;
  padding: 5px;
  font-size: 0.84em;
}

.image_caption img {
  float: left;
  margin-right: 5px;
}

I've seen this before and got round it by adding <br style="clear:both;">. That also works in this case but has to be inserted by the filter, a horrible kludge.

Aside from this issue (which isn't really related to the filter) I'm pretty happy with the enclosed patch.

AttachmentSize
image.module_24.patch 11.13 KB
 
 

Drupal is a registered trademark of Dries Buytaert.