Closed (won't fix)
Project:
ImageField
Version:
5.x-2.1
Component:
User interface
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
28 Jul 2008 at 20:43 UTC
Updated:
15 Mar 2009 at 02:54 UTC
Jump to comment: Most recent file
Comments
Comment #1
ajayg commentedCould you please share your hack to use node type token?
Comment #2
jmstacey commentedI made a few adjustments and created a patch which you will find attached. It enables all token replacement possibilities.
I haven't tested or looked at all of the tokens that this makes avaialable to make sure that they are applicable but it is working properly for my needs (the [nid] token).
Comment #3
whisk commentedUh... Not worked for me. I believe, there is no 'all' mode for token_replace().
Instead, I've created a quick and dirty patch just for node tokens.
[nid] works perfectly, but keep in mind that it's not possible to use node tokens before node gets created. So, when creating a node, you should not upload images, just specify only one image ("browse" button) and hit Submit. After node is created, there is no restrictions.
Comment #4
jmstacey commentedWhat version of token and imagefield are you using? It seems to be valid for me on 5.x-1.11 patched against imagefield 5.x-2.1
Comment #5
whisk commentedToken: version = "5.x-1.11"
Imagefield: version = "5.x-2.1"
Comment #6
dagmarI have created another patch. It uses both, node and user token replacement patterns.
Also it uses collapsible fieldsets like pathauto or workflows ng.
Comment #7
jmstacey commented@whisk, you're completely correct, it does not work (just retested). That was very sloppy of me and I apologize. The 'all' does end up showing all available tokens on my end however the actual substitution does not take place. The patch from dogmar works correctly and is more elegantly implemented.
Using [nid] appears to work correctly after performing this fix: http://drupal.org/node/207768
Comment #8
jajathejazzcat commentedFYI, I have used [path-arg-2] token to replicate nid. Even if you have an alias url, the system path will be used (e.g. example.com/node/1/edit). Of course there is still same limitation that you can only upload images after a node is created, as whisk said in comment #3, but it might be better than hacking the module.
Comment #9
whisk commentedYes. The only solution is to fix the module so all image attachments would be processed after actual node creation, like in upload module (AFAIR).
Comment #10
roderikAttachments _are_ actually processed after node creation.
Only the link to the preview image is broken; after actually saving the node after preview, everything is OK. (At least after you've applied http://drupal.org/node/207768#comment-1079996; I have not tried without.)
During the preview phase, the image files are actually still called something funny like 'files/tmp/tmp_IGxOnZ'... the menu system just creates temporary 'normal' aliases for them. Apparently those aliases cannot have double slashes in them, so I modified dagmar's patch (#6) a little. Things work for me, now.
N.B.: there is a 'directory creation' statement in this preview phase, which I think is unnecessary, but I didn't dare to delete it :) So I just put a comment behind this like "is this necessary?".
Still 'code needs review'.
Comment #11
quicksketchNew features are not being added to the Drupal 5 version. In Drupal 6 try the FileField Paths module.