Hello...
I've been working on a new version of the Inline module (see http://drupal.org/node/163806 and http://demo.netfocal.com for info).
During part of the process I noticed that freshly uploaded images (that are still in temp and haven't been "submitted" with the node yet) have trouble being previewed with imagecache/thickbox. It turned out to be a two part problem so I've submitted a patch to imagecache (http://drupal.org/node/146861) and am submitting a patch here for thickbox.
Bascially it just looks for new uploads and sets the path to where the file *will* reside after being submitted. Then imagecache will handle the "preview" after it is patched.
There is one other change in this patch at the very beginning. It's just something on I was noticing w/ imagefield. When you add an imagefield to a content type and *don't* enable the "multiple" option it can cause trouble. Basically if you upload and image in that field and then later delete it, it still sends the $item into field_formatter with the old fid. However it's missing the filepath (as it has been deleted), so I just added that as a sanity check.
Let me know what you think and if there are questions... thanks, and I like thickbox :)
| Comment | File | Size | Author |
|---|---|---|---|
| thickbox_0.patch | 1.44 KB | Moonshine |
Comments
Comment #1
designwork commentedHi Moonshine,
this looks good for me. I will test it today. Just one more question i can display the title of the image in Thickbox like i wrote in http://drupal.org/node/144021 but im trying to show the name of the owner as well like print $user->name but it never worked out. Do you have any idea?
Dirk
Comment #2
Moonshine commentedHello Dirk...
If you're talking about getting at the username within thickbox_field_formatter(), you can do so but it's a little costly. The node being worked on is not sent into that function so you would basically have to load it from the node ID stored in $item. Something like this:
node_load($item['nid'])->name)
would get you the username associated with the node that item is a part of. So then you could set that as part of the title that is passed in the theme() function at the end. Just altering $item['title']...
Comment #3
frjo commentedComment #4
frjo commentedClosing old issues, please reopen and update if there is a need for it.