I first have problem when I edit node with a video thumnail. I can't save the form because I get this error:

The file used in the Video thumbnail field may not be referenced.

I can delete the file trough the Ajax UI and I get:

Notice: Undefined index: thumbnail in file_ajax_upload() (line 261 of mysite/modules/file/file.module).

This is another core bug #1067470: PHP notice on AJAX upload for file_managed fields added during element #process callback and #1217802: Notice: Undefined index: thumbanail in file_ajax_upload() (line 256 of modules/file/file.module).

but I'm able to add a image and save the node

If I edit the node again I will have the issue again..

I saw is thumbnail files are not added in the file_usage table. I try to add the thumbnail file manually in file_usage and everything was fine after... no more error.

Comments

gagarine’s picture

Issue summary: View changes

Updated issue summary.

gagarine’s picture

Issue summary: View changes

Updated issue summary.

gagarine’s picture

Issue summary: View changes

Updated issue summary.

gagarine’s picture

Issue summary: View changes

typo

gagarine’s picture

The problem is around video_field_presave, insert and update.

Btw, why the thumbnail is not saved in a standard image field?

Quick fix:
- in the video_field_insert function add file usage for each added thumbnail
- in video_field_update remove usage and add a new one
- in video_field_delete remove usage and file.

This sound ok for you?

gagarine’s picture

Status: Active » Needs review
StatusFileSize
new5.81 KB

Here a patch than should solve the problem. This certainly also need an update path to add all the file file_usage table...

Again, I think the storage structure should be different. Also the video can be only a wiget for a standard file field with some metada... Now video field wrap some file_field hook to save the video field... not sure it's a very good practice.

andypost’s picture

Version: 7.x-2.4 » 7.x-2.x-dev
Status: Needs review » Needs work

@gagarine having custom field is right choice but problem in widget implementation

agree with strange behavior about thumb but current version of the module saves thumb but editing of the node broken (with your patch too)
The file used in the Video thumbnail field may not be referenced.

gagarine’s picture

With my patch if you create a new node you can still not edit/delete them without problems? It works for me :/. As I say nodes created before patched will not work and we need an upgrade path.

gagarine’s picture

Status: Needs work » Needs review

Can someone test and review with new nodes and confirm this patch works (or not). I can provide after a upgrade path when I know the system works.

ivanhi’s picture

StatusFileSize
new21.38 KB

I'm really greatefull. I have spent many hours looking for a solution to the mad message The file used in the Video thumbnail field may not be referenced. but I have implemented your patch and the problem is fixed.

I haved to erased the previous thumbnail and then upload again it with the content already uploaded.

I have no much idea about using patches, so I will be really glad if you can check If I used it properly.

Thanks a lot.

Status: Needs review » Needs work

The last submitted patch, 1441626-2-commit_5eaeb084baf6.patch, failed testing.

Jorrit’s picture

Status: Needs work » Fixed

I have committed a fix that is similar to the patch but tries to reuse the file_field_* functions where possible. I have also fixed the situation where the default thumbnail is deleted when the last video that uses it is deleted. The notices are also gone.

Please test the next 7.x-2.x-dev release (current one is: March 2, 2012 - 01:43) and let me know if all your problems have been fixed.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

Anonymous’s picture

Issue summary: View changes

Updated issue summary.