Hello,

I got this issue when my module FeedAPI ImageGrabber was reported not to work with Filefield Paths. I figured out that Filefield Paths checks the form id of the node on Line 47, filefield_paths/modules/filfield.inc

 function filefield_filefield_paths_get_fields(&$node, &$ffp) {
  if (is_object($node) && $node->form_id == $node->type .'_node_form') {

As ImageGrabber module uses node_save to update the nodes, so no form id is available. It loads the node using node_load, add image to an imagefield and save it using node_save.

But I was able to make it work by following these steps:

1) I removed the second condition from the 'if' which checks the form id of the node.
2) I added the data array with process value set to TRUE.
3) I added the additional information required by the Filefield Paths module during processing, (filename, filepath) which imagegrabber was not adding by default to the field.

Do you think this can be integrated with Filefield Paths module where other modules can set some variable to let you know if to process this node or not, when it comes for update rather than checking for form id.

Thanks.

Comments

deciphered’s picture

Category: task » feature

The reason the logic that is in place is in place is so that the module can differentiate the source of the files (the modules used to upload) so as to apply the correct settings to the files.

However your request is logical, I will have to look into the actual implementation as I believe what you did will actually create issue for some use cases.

Marking it as a feature request and I will try to look into it soon, but my current priority is bugs and a Drupal 7 port.

Cheers,
Deciphered.

publicmind’s picture

Thanks.

I understand the issues with my implementation, it was just to debug why the two modules weren't working together.

I hope to see a better implementation of it soon. have a good day.

nitin

deciphered’s picture

Status: Active » Closed (won't fix)

Hi publicmind,

I had a further look into this issue and I have decided that a change on FileField Paths behalf would not be the correct way to proceed. The $file object that your module is passing to the node is not a fully formed $file object, which is the primary cause that it is not working.

Have a look at how Imagefield Import does things, as they actually use a FileField function to do most of the hard work for them.

Also, on a side note, one of the issues I ran into while testing your module was the PHP execution time, which if you use Drupals batch API you would be able to solve in no time.

Let me know if there is anything I can do to help.

Cheers,
Deciphered.

publicmind’s picture

Hi Deciphered,

As I wrote in my first post, one of the cause for two modules not working together was that I was not passing a full $file object. The other reason that I mentioned was you checking the form id. of course, I have to pass the full file object but that won't solve the problem without a hack (I can set the form id of the node to $node->type_node_form).

@Imagefield Import: I came across the upload functions of filefield when I had already written the code. So, I thought of sticking with mine as they are essentially the same piece of code inspired by the core file.inc. :-)

I will give Batch API a look to see how it can help.

Thanks for your help,

publicmind

deciphered’s picture

No problem.

Also, the dev build had actually removed the particular $form_id check, so if there $file object was right, there should be no issue. If there is, I'd be more than happy to look at it further.

Cheers,
Deciphered.

publicmind’s picture

It works great now. Thanks, though I am still providing the hack for your 1.3 users. Also, Batch API looks promising, I will give it a try as soon as I get time.

Regards,
publicmind