Closed (won't fix)
Project:
ImageField
Version:
6.x-3.0-beta3
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
6 Jun 2008 at 02:00 UTC
Updated:
23 Mar 2009 at 19:29 UTC
I made a patch to use node tokens instead of user tokens for the saved image filepath
There are more options using node tokens than user tokens and the $node object is available when the tokens are made. node tokens also include several user related tokens.
I especially like using [type]/[yyyy]/[mm] or [type]/[author-uid]/[yyyy]/[mm] for the filepaths.
I know a design decision was made to use user tokens, but if anyone wants to use node tokens in the saved filepath, see the attached patch.
the patch makes the node token list available on the imagefield configure page and is tested and working for date tokens on imagefield uploads.
regards,
DT
P.S Here are some of the node tokens available:
Node tokens
[nid] Node ID
[type] Node type
[type-name] Node type (user-friendly version)
[title] Node title
[title-raw] Unfiltered node title.
[author-uid] Node author's user id
[author-name] Node author's user name
[author-name-raw] Node author's user name.
[term] Name of top taxonomy term
[term-raw] Unfiltered name of top taxonomy term.
[term-id] ID of top taxonomy term
[vocab] Name of top term's vocabulary
[vocab-raw] Unfiltered name of top term's vocabulary.
[vocab-id] ID of top term's vocabulary
[yyyy] Node creation year (four digit)
[yy] Node creation year (two digit)
[month] Node creation month (full word)
[mon] Node creation month (abbreviated)
[mm] Node creation month (two digit, zero padded)
[m] Node creation month (one or two digit)
[ww] Node creation week (two digit)
[date] Node creation date (day of month)
[day] Node creation day (full word)
[ddd] Node creation day (abbreviation)
[dd] Node creation day (two digit, zero-padded)
[d] Node creation day (one or two digit)
[mod-????] All tokens for node creation dates can also be used with with the "mod-" prefix; doing so will use the modification date rather than the creation date.
[menu] The name of the menu the node belongs to.
[menupath] The menu path (as reflected in the breadcrumb), not including Home or [menu]. Separated by /.
[menupath-raw] The unfiltered menu path (as reflected in the breadcrumb), not including Home or [menu]. Separated by /.
[termpath] As [term], but including its supercategories separated by /.
[termpath-raw] As [term-raw], but including its supercategories separated by /.
[termalias] URL alias for the term.
CCK image tokens
[field_images-fid] Image file ID
[field_images-title] Image title
[field_images-alt] Image alt text
[field_images-filename] Image file name
[field_images-filepath] Image path
[field_images-filemime] Image MIME type
[field_images-filesize] Image file size
[field_images-view] Fully formatted HTML image tag
Global tokens
[user-name] The name of the currently logged in user.
[user-id] The user ID of the currently logged in user.
[user-mail] The email address of the currently logged in user.
[site-url] The url of the current Drupal website.
[site-name] The name of the current Drupal website.
[site-slogan] The slogan of the current Drupal website.
[site-mail] The contact email address for the current Drupal website.
[site-date] The current date on the site's server.
| Comment | File | Size | Author |
|---|---|---|---|
| imagefield.module.patch | 2.77 KB | davidwhthomas |
Comments
Comment #1
davidwhthomas commentedComment #2
dopry commentedNot something I'll support. Apply at your own risk.
Comment #3
adrien.felipe commentedThis is exactly what I was looking for. It's just frustrating it's for 5.x and not 6.x.. !
Why shouldn't we have access to all tokens like everywhere? If this patch works, I guess it means that it would be possible, right?
This is something we should be able to do with the images filepath, alt and title fields
Default Title text:
[vocab-raw]-[cat-raw]-[title-raw]
I've been trying out with the Custom token module but it didn't work out.
Why are tokens limitated like that?
Does someone know a way?