In order to use the Asset Module for creating professional article it's important that there's the possibility to insert a caption to every image. Looking at the Asset Wizard it would just have to be an additional form field at the end called "caption". When filtering the asset pseudo code [.....] and creating the HTML code the image would have to be surrounded by a div so that the caption can be right under the image with the right width.

Numbering of the images would not be needed.

Should look like: http://www.nytimes.com/2008/02/28/world/europe/28grapes.html?_r=1&hp&ore...

There is the map and then the caption "Foreigners are shopping for land near Bordeaux, France."

Hope this was clear ;)

Keep up the work.

Comments

wmostrey’s picture

Hey Raphael,

Have you tried using assets with CCK? They have exactly that: a copyright (author) and a caption field. When you're using TinyMCE or aregular textarea you could enter the caption or any text you'd like yourself of course.

Does this answer your question?

rapsli’s picture

Hm, doesn't seem to work. I'm using a plain Textarea:

[asset|aid=2|format=image|formatter=asset|title=Monkey Island Screenshot|width=393|height=354|resizable=true|align=none|caption=ich bin die bildunterschrift]

Doesn't seem to work :(

wmostrey’s picture

What I mean with enter the caption yourself is in plain html:

[asset|aid=2|format=image|formatter=asset|title=Monkey Island Screenshot|width=393|height=354|resizable=true|align=none]
<div class="caption">Monkey Island Screenshot from Chapter 1</div>

If you use the cck fields, there is a textfield next to the asset preview where you can fill in the copyright and caption.

rapsli’s picture

Yes I can, but then it's becoming a formatting problem. -> I guess I could then just add the proper html syntax

Image Caption

But from a user perspective this is not a good solution. Espacially when the image is being aligned left or right this is going to be a problem. The user then has to use a whole div that goes around the image... => poor usability.

I guess my feature request remains ;)

wmostrey’s picture

I agree with you, it's also not very consistent to offer this functionality for CCK but not for regular inserts. This should go in a nice theme-able function so it can be overwritten easily. I'm currently not sure how I will fix this cleanly, let me think about it.

And of course, you're always welcome to submit a patch yourself.

rapsli’s picture

The way I would do it (I haven't looked at the code yet):

At some point you must do some kind of replace with some regular expression. I guess it shouldn't be too hard to filter out the caption=bla bla bla. Then I guess the information is being stored in some variables. So at some point there is going to be an img tag, and this is probably assigned with the class for the alignment.

These Information get now into a surrounding div. Probably you have to use inline style sheet to assign the div a fixed width. Now you can just add the $caption variable and wrap it in a div and assign it with a class="caption".

Does this sound reasonable?

brianV’s picture

Just checking in - has anyone moved forward with this?

This is a must-have feature for two sites I am working on...

mfer’s picture

I don't see the issue here. I'm still trying to figure out the problem. A caption is recorded when you add an image. And, there is a theme function tied to the display of the image so it can be altered to shop the caption any number of ways.

wmostrey’s picture

The problem here is usability. You can alter the caption that was entered when you uploaded the asset in a CCK field. This option is not available with a textarea/TinyMCE asset, and I do agree that it should be available. I'm not sure what the best way is to fix this though.

brianV’s picture

Just bumping this feature - I have two projects waiting on this.

Would it make sense to look at how img_assist handles their image captions? They seem to do it in a fairly reasonable, logical way that integrates well both with the regular textarea and TinyMCE.

chrisyates’s picture

I'm working on a patch to provide this functionality. I've got it working as I think rapsli requests - users can add captions via the wizard using the description field, and these can be overridden at insertion time just like the title or author field.

Instead of just drawing an image tag, the asset_theme function draws a div containing the image and a caption div. These can be styled to taste. This also fixes a problem with imagecache overriding the alignment setting set by the asset module.

I also have attempted to fix an issue with incorrect widths being returned to the wizard when using imagecache2.

I'll upload shortly once finished testing, but I do have a question for the maintainers - is there a reason why the 'description' field was not being updated along with the other fields on the asset edit page of the wizard, or is this simply an oversight?

--
Christian Yates
Mars Space Flight Facility
Arizona State University

wmostrey’s picture

Hey Chris,

Thanks a lot for your work on this, it is highly appreciated!

What exactly do you mean with your comment about the description field not being updated? Could you give an example? I'm not sure what you mean.

chrisyates’s picture

I just realized that I'm working on a version of the DRUPAL-5 branch, so this may not be applicable to HEAD, however, regarding your question, in asset_wizard.inc at in the Edit case, though there was a text field provided for Description, it wasn't being saved to the database. I added the following:

        $form['description']['#default_value'] = check_plain($asset->description);

...at the end of the 'Edit' case.

Additionally, on the asset insertion step 3, the Description field wasn't being provided at all - just the Title and Author fields.

Unfortunately the production version I'm working with is an outdated (asset.module 1.1.2.24) and patched version, so it is going to take me slightly longer to prep a patch for the clean version of the DRUPAL-5 branch, and then a bit longer than that to patch HEAD, but I plan to do so.

wmostrey’s picture

Status: Active » Closed (won't fix)