Hello,

I needed to set automatic alt and title texts for my image field, depending on the node (I'm using node title and body).
To do this, I wrote my own module, which alters ImageField forms, and processes to the node token replacements after the node is save (hook_nodeapi, operation presave).
I think this module could easily be included inside ImageField module (or as a contrib module). What do you think of it ?

Please see attached file.

Regards,

David

CommentFileSizeAuthor
imagefield_token_extra.tar_.gz939 bytesDavid Stosik

Comments

idflorin’s picture

I tried this on one site with ImageField 6.x-3.3 and [title] as token but alt and title are still empty after save.

David Stosik’s picture

Hello,
Can you check you Recent log entries ?

This module works on my side. I tried both "Enable custom alternate text" checked and unchecked (thus permitting to modify the alt text on the node form, or not), and both work...
Oh, by the way, you need to save the node containing image fields again. ;)

David

idflorin’s picture

You are right it's working, but it's not working for my particular site setup. I use feeds with image feeds grabber, and in this particular case it's not working.

David Stosik’s picture

If you don't use tokens, but normal text in widget's default alt and title fields, is it used ?
If no text is showing as title and alt, (a token or its value, or some text), then the problem does not come from my module, but from image feeds grabber.

By the way, I encountered some errors, and need to change the behavior of my module (using hook_nodeapi, operation presave makes token generate errors because some field are not already filled). I will post a new version as soon as it is developed.

David

quicksketch’s picture

Status: Needs work » Fixed

This code already exists as a separate project: http://drupal.org/project/imagefield_tokens

David Stosik’s picture

Oh god, why didn't I find this module before... ::)

Thanks quicksketch, I'm going to try this immediately.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.