Closed (won't fix)
Project:
ImageField
Version:
6.x-3.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
4 Sep 2007 at 05:39 UTC
Updated:
2 Jan 2014 at 19:04 UTC
Jump to comment: Most recent
Comments
Comment #1
bsuttis commentedI believe I've gotten to a solution, although I very much doubt it's implemented as well as it could be.
What I did was go through the DRUPAL-5--2 imagefield.module, find the token_replace functions and any reference regarding tokens, removed the
global $userchecks, and replaced the 6 instances ofuserand$userwithnodeand$node.Seems to be working from the limited testing I've done. Having my path as files/[term], and adding an image to a node with a category of foo adds the image to files/foo.
I wouldn't attempt a path though as this removes the $user variables -- however in my case, I have no use for user folders.
Any advice is appreciated.
Comment #2
sunBetter title.
Comment #3
bfsworks commentedI tried this work around without success. I suggested in another thread that pathauto be used to set image paths.
Comment #4
yan commentedGreat that token support is going to be included. I'm waiting a while for that already. Thanks!
One thing though: I was hoping to be able to use [yyyy] and [mm] for year and month, but it doesn't work. Instead there are a couple of date functions ([site-date][log-date][date-in-tz][account-edit]) but they give out really weird folders like
/Thu, 12/13/2007 - 17:45/I'd be great if more usability was added to this, providing tokens that make more sense for paths.
Comment #5
dopry commented@yan, post your request in the token module issue queue.
I'd still love to expand the token support, but there are some issues that need to be figured out.
1) Should we wait until node submit to save all the file information (This won't be possible in D6 as the file workflow changes), but we could update file on new node insert.
2) Should we update the filepaths/url when tokens change on node updates? This causes link rot.
Lets slate this as a 2.1 feature.
Comment #6
yan commentedthanks for your reply, dopry
I posted the issue here because I don't think it's a token issue. Right now I'm using the File attachments field to have pictures stick to a node (afterwords I manipulate them using imagecache). There I'm using the upload path module which works with the token module. There are no problems using [yyyy] and [mm], it uses the actual date when the node is published. If you attach an image to an older node (i.e. to a node from a month that finished already) the node creation date is used. This seems to be a perfect solution for me. I was wondering why file attachments & upload path & token do work this way while imagefield & token don't.
Comment #7
dopry commented@yan, for the reasons outlined above... I don't have a created date/time for the node at the time the file is created... The file is saved to it's destination before the node is created. I have nightmares about preview paths and final paths differing... You know breakage...
I've thought about this more and I'm simply not going to fix this issue. There is a patch in the token issue queue for site-date-[Y,y,M,mm,dd] etc tokens that use the site's unixtime to generate the token values.. Review and get eaton to commit.
Comment #8
yan commentedI think I see what you're saying, but I still don't understand what I wrote before: