When "Manually Upload a thumbnail" is checked, uploading or removing a video thumbnail results in this error although the upload is successful.
I believe this is as the thumbnail field is added by the '#process' on the widget and as such when file_ajax_upload retrieves the form from the cache it does not contain the "thumbnail" field. As such when it attempts get the current element and count the number of files it cannot find the field resulting in the error provided in the title.
I believe the upload works as the current file count defaults to zero in file.module, however, this may have some knock on effects with multiple file fields on the same page (although I cannot vouch for this as I have not tested and don't know the workings well enough).
Either way this error is annoying and can be fixed by ensuring video_field_widget_form includes the 'thumbanail' field.
My quick fix at ln305 of video.field.inc was
if(!isset($elements[$delta]['thumbanail'])){
$elements[$delta]['thumbanail'] = array(
'#type' => 'value',
'#value' => NULL,
);
}
however, I'm not sure what knock on effects this has (as it still doesn't set the element count that file_ajax_upload is looking for) and I'm sure the maintainer will be able to solve this more satisfactorily.
Cheers,
Lewis
Comments
Comment #1
loominade commentedI have the same error which seems to be connected with #1233604: Thumbnails are dissappearnig.
the following error appears on uploading a thumbnail manually or deleting an existing thumbnail:
after saving i get this:
Comment #2
hypertext200Duplicate of #1103942: array_flip() [function.array-flip]: Can only flip STRING and INTEGER values! in DrupalDefaultEntityController->load()
Comment #3
cclafferty commentedI am also receiving this error however I have reopened this issue as I am not experiencing the "array flip" problem which others are claiming. Simply put, I get this exact error:
Notice: Undefined index: thumbnail in file_ajax_upload() (line 256 of /var/www/supponor.com/dev/htdocs/modules/file/file.module).
I have manual upload of thumbnails enabled and using zencoder as my transcoder. Any interaction with the thumbnail field shows the above error. Adding a thumbnail or removing it.
I am also having issues with thumbnails disappearing. I go to edit the content after they disappear and the thumbnail field is empty with the words "Remove" as its button action. I've tried running cron to see if there's a hook deleting my images but there is none. I have no idea how this is happening however I intend to spend a few hours today finding out.
Comment #4
hypertext200Please upgrade to the latest version.
Comment #5
cclafferty commentedGreat job with the new version hashan, the ffmpeg version information pulls through correctly now which is great. Unfortunately the new version does not correct the problem with the undefined index or the disappearing thumbnail images.
I did however find the problem with our disappearing images. Manually uploaded thumbnails are set to TEMPORARY. Turns out video_field_presave in video.field.inc doesn't care for a thumbnail value. It only checks if we've set a default thumbnail or not. When passing $items onto file_field_presave the thumbnail property is simply ignored. Hence on a cron run the these temporary thumbnails are deleted.
Here is my crude fix which I have just gotten working 5 mins ago. It just ensures we have new items for our thumbnails for the file_field_presave to make PERMANENT.
Add this under line 138 of video.field.inc version 7.x-2.2-beta4
Still having problems with the previous error though. Will post back if I find anything.
// Edit: Changed code to reflect patch
Comment #6
hypertext200Nice work around, could you please provide a patch?
Comment #7
cclafferty commentedDisappearing thumbnail patch is here: #1233604: Thumbnails are dissappearnig
Undefined index error still exists as a separate issue.
Comment #8
hypertext200Please see #1067470: PHP notice on AJAX upload for file_managed fields added during element #process callback this is a core issue you can apply that patch and fix that notice.
Comment #9
hypertext200Comment #10
dealancer commentedThis error happens even when uploading file on post and not on AJAX request.
I have following error message when clicking Save button:
Comment #11
andypostAnd there's no notice in core's file upload widget
Comment #12
Jorrit commentedComment #13
Jorrit commentedThis issue has been fixed as part of #1441626: thumbnail are not added in file_usage table.