Update to 4.7.1
jsloan - May 12, 2006 - 19:17
| Project: | image_import |
| Version: | HEAD |
| Component: | Code |
| Category: | task |
| Priority: | normal |
| Assigned: | syscrusher |
| Status: | patch (code needs review) |
Jump to:
Description
... I see there is some work on this module to make it work with 4.7.0 - I downloaded CVS and tinkered with it this afternoon and here is a patch that seems to work. Please review and clean-up where necessary.
thanks
jim
| Attachment | Size |
|---|---|
| image_import-4_7.patch.txt | 3.33 KB |

#1
I found an issue when using this patch with the image_exact module. image_exact's nodeapi expects a node_validate to rewrite the thumbnail sizes. The patch says:
// saving a node - first step is to validate$node = node_submit($node);
if ($node->validated) {
// ... then we save the node
node_save($node);
but no validate is ever called.
#2
I think that the image_exact module should be using node_submit(). According to the documentation the node_submit() function prepares node for save and allow modules to make changes. Please correct me if I misunderstand.
#3
But 'submit' isn't part of the nodeapi, http://drupaldocs.org/api/head/function/hook_nodeapi
So other modules can't hook into image_import if the only call it makes is node_submit, right?
#4
Perhaps this question is for syscrusher, the module author. Here is what I think is the nature of this problem.
The documentation says this about the hook_nodeapi; "If you are writing a node module, do not use this hook to perform actions on your type of node alone. Instead, use the hooks set aside for node modules."
This module is written as an extension to node and creates a node type "image_import" - so I see why it would use the node_hook() functions.
But the documentation does say this "To take action when nodes of any type are inserted (not just nodes of the type(s) defined by this module), use hook_nodeapi() instead." which is exactly what the image_exact module is doing therefore using the hook_nodeapi()
I submitted my patch because it worked for me, there has not been any response nor any updates on the status of the 4.7 release of this module. (My patch is for the CVS file tagged "image_import.module,v 1.17 2005/11/20 03:31:19 syscrusher")
I'll dig a little deepr to see what is the "best practice", "more correct", or "less wrong" way to handle these module interactions.
#5
I am totally with you on the 'how do I do this in the least-wrong way' :)
I ppreciate your patch and am using it. If not for the image-exact incompatibility I found, it is working find for me.
I'm writing a huge patch for the module now that changes how the images are imported so they won't time out the server. I too hope I'm doing it the 'right' way.
#6
I've create a new issue for the problem of the hook_nodeapi()
see: http://drupal.org/node/66571
#7
jsloan and tayknight, thanks to both of you for this troubleshooting and patching work!
I didn't want to post the fact on the internet, for obvious security reasons, but I have been out of town on business for most of the past 6 weeks and have have very little time to work on Drupal projects. This work from the two of you came at a time when I really needed some help, and I am very grateful.
I applied and tested jsloan's patch, and with the exception of one cosmetic bug (which, oddly enough, I don't know how to fix yet!), it works. I realize, from this issue thread, that we're not done yet -- but this patch made the module 4.7-compatible, and it's good enough for an early beta.
The one cosmetic bug I've found is that the word "image" is spuriously displayed next to the "import images" submit button. I know *why* this is happening -- it's the following code line:
$form['type'] = array('#value' => 'image');But I'm not sure how to get rid of it without breaking jsloan's taxonomy form trick. Comments?
I'll have further comments and/or questions when I've had more time to study the node hook issue. Right now, I'm just getting my head back into Drupal after about 6 weeks of absence, and I don't have anything intelligent to say on this subject yet -- so I will avoid looking the fool by remaining silent at the moment. :-)
Thanks again for a much-needed patch and a very beneficial discussion thread.
Kind regards,
Scott (Syscrusher)
#8
Hi all, this module looks great thanks, any progress on the release date for a stable 4.7 release??
Thanks