Problem/Motivation
Currently media 2.x does not provide the ability to select / upload multiple files.
Proposed resolution
Implement multi select / upload functionality.
Remaining tasks
Test the most recent patch from #219.
User interface changes
Provides the ability to select / upload multiple files. This changes the field to be a list of files with thumbnails (like a single item, but now times X).
API changes
None.
Data model changes
None.
Test instructions
If you have media_multiselect enabled:
- Switch all media multiselect widgets back to media widgets.
- Uninstall media multiselect.
- Proceed with the text below.
If you do not have media_multiselect enabled:
- Download and apply the patch from this issue.
- Make sure to allow multiple files to be uploaded at the field configuration.
- Now try to upload multiple files.
Original report by justinlevi
Having some functionality where the user could select multiple images in the media browser and implement a jquery slideshow would be pretty huge.
Can anyone help outline how something like that could be implemented with the media module? I've been familiarizing myself with the code and might like to take a whack at something like that.ong>
Comments
Comment #1
JacobSingh CreditAttribution: JacobSingh commentedCheck out http://drupal.org/project/media_gallery, http://drupal.org/project/roating_banner and http://drupalgardens.com
Best,
Jacob
Comment #2
justinlevi CreditAttribution: justinlevi commentedThe Media Gallery looks really interesting. I'll definitely check that out.
Just a note that the URL for the rotating_banner project above is incorrect.
http://drupal.org/project/rotating_banner
Comment #4
dmsmidtI hope this is not a hijack ^_^ but I'm still really interested in a multiple select (and submit) option.
There are a lot of people searching for something like this. Media_Gallery offers this function but I don't want the Gallery.
I would like this option simply for a Media field with multiple items. Currently we have to click "Add new item" -> "Select media" etc. every time, this is very much work for 100 files.
With plupload I can upload a lot at once (although not through the node/edit form).
I'd like to be able to just select multiple files and them to the media field at once.
Or is this something for media_brower_plus ? (But it's a bit of an unclear mess for me..)
Isn't it possible to use the code of Media_Gallery?
Comment #5
james.elliott CreditAttribution: james.elliott commentedRetitling to better represent the request.
Comment #6
slashrsm CreditAttribution: slashrsm commentedI am trying to implement this, but I ran into a problem. My plan is to change Media's Multimedia asset field that way, that is supports this.
I was modifying js code that handles this things. I managed to recognise multivalue field and to send multiselect=true to media browser. That allows user to select multiple items, which are then returned to JS as an array.
My intial plan was to clone field items, which would allow me to add all assets from array. I would then just correct IDs of elements. It turned out that this does not work, as Drupal expects AJAX call for every item that is added.
Second idea was to call that AJAX call from JS code, to create all items I need. I was trying $(add_item_button).trigger('mousedown'), which actually adds another item, which is done asynchronously. The problem is, that I am not able to populate new items with assets from array, since that data is gone when AJAX call is completed.
Any suggestion how to solve that?
I also described my problem in forum: http://drupal.org/node/1138990
Comment #7
slashrsm CreditAttribution: slashrsm commentedI've pushed my work to a sandbox: http://drupal.org/sandbox/slashrsm/1144920. Changes were made to 'javascript/media.js' only.
Comment #8
SanderJP CreditAttribution: SanderJP commentedHey slashrsm, I have a very ugly solution for this based on your trigger. I've used a timeout to wait for the new item to be added. I think it can be optimized alot, maybe a totaly different approach all together but I need this working in a week so I'll do it with this, for now.
I'm also not too experienced with the git yet, so I'll just post the code here that I made in media.js at the place you had the trigger function.
Download this js for the timeout function (doTimeout): jQuery doTimeout (jquery.ba-dotimeout.js) and add the following line to media.module (line 739) to load it:
(more info on the function here: Ben Alman doTimeout)
Here's the code I made (yes quite silly, but it works! :P):
The reason of the vars a and b is cos the first time you click 'add item', there are 3 ajax calls being made, so you need to wait till the third one to fill in the fields. Also the parents in the trigger don't work after the first one, so had to change that. Also had to change the n var to find the right tr element for some reason.
Let me know if it works for you, I haven't tested it yet on a clean install.
Comment #9
dmsmidtIt works a bit, thanks you two. I used the git version (#7) of media with your changes (#8).
(Though not very clear what to do and added the $path to line 759, not 739)
It only manages to add 3 items at once, also if I add 4 or more.
Side effect: The plupload module started to show up! Uploading multiple items worked, but sending them didn't.
Please if you have anymore progress let us know! Or how I can add more than 3 items at once. This is such an important feature.
Comment #10
wojtha CreditAttribution: wojtha commentedsubscribing
Comment #11
dmsmidtI edited the media.js code sample of sanderjp in #8, so that it works with unlimited items. It even works with plupload (uploading multiple files).
It's a very bad solution, because the process of adding items will increase per extra item (i*1000), and your computer needs to be powerful enough. But I needed a solution 2 weeks ago, so I'll take it for now.
Comment #12
pp CreditAttribution: pp commentedHi, I made a module which resolve this issue.
http://drupal.org/sandbox/pp/1244926
If it is usable, I would like to create a patch to media modul.
Comment #13
idflood CreditAttribution: idflood commentedI would love to see that integrated in media module instead of media_gallery. Being able to select/upload many medias at once and associate them to a node is definitely an expected behavior.
Any "official statement" about this?
Comment #14
dark11star CreditAttribution: dark11star commentedI tried this and It still only adds one of the selected images.
Comment #15
pp CreditAttribution: pp commenteddark11star: thanks, but just a question: Did you click "Select media" or "Add another item" button?
http://drupal.org/node/1244950
If you used "Select media" please try "Add another item" button instead of it!
Select media for one image, and add another item for add multiple images.
pp
Comment #16
artatum CreditAttribution: artatum commentedHi
Very interested by this feature, I'd like to download it but 'git clone etc' doesnt mean anything for me.
Is there a possiblity to simply get your module somewhere?
Comment #17
slashrsm CreditAttribution: slashrsm commentedpp's project is a sandbox. Sandbox cannot have any releases you could download, so you must use git.
Check: http://drupal.org/project/1244926/git-instructions
Comment #18
dboulet CreditAttribution: dboulet commentedThis would be a great feature to add. It looks like the maintainers are now focusing on the 2.x branch, we should probably try to produce a patch for that version.
Comment #19
hk0023 CreditAttribution: hk0023 commentedI don't know why the original media file selector widget still pops up instead of plupload. Is anyone else having this issue?
Comment #20
hk0023 CreditAttribution: hk0023 commentedSorry, didn't read the comments above. Need to press the Add Media button instead of Select Media.
Comment #21
hk0023 CreditAttribution: hk0023 commentedHowever, I have another problem. Once I have uploaded one item, whenever I press the select media or the add another item again, the formatting of the popup widget is all weird.
Comment #22
dboulet CreditAttribution: dboulet commentedHi hk0023, look at #1228790: Popup browser broken when using "Add another item" on multiple field, there’s a patch in that issue that fixes the last bug you mentioned.
Comment #23
hk0023 CreditAttribution: hk0023 commentedThank you dboulet, everything's working fine now.
Comment #24
rickvug CreditAttribution: rickvug commentedSubscribe.
Comment #25
Dave ReidComment #26
Shawn DeArmond CreditAttribution: Shawn DeArmond commented#1186516: Allow multiple file upload via plupload on field widget. was marked as a duplicate, so I'm going to watch this issue now
Comment #27
Andrea C CreditAttribution: Andrea C commentedSubscribe
Comment #28
sachbearbeiter CreditAttribution: sachbearbeiter commentedsub
Comment #29
kirilius CreditAttribution: kirilius commentedI would also like to see this feature becoming part of Media. I am trying to use Media not as a generic file organizer but as a means to manage multi-value images within a single node.
Comment #30
heyyo CreditAttribution: heyyo commentedIs the sandbox project in #12 working with media-7.x.2.x ?
Comment #31
rudiedirkx CreditAttribution: rudiedirkx commentedPlease don't use crappy 1990's plupload. Who the hell uses flash to upload files? It's almost 2012! HTML 5 is not new anymore.
Use the multiple attribute that ALL browsers (except IE 8-) support. And if the browser doesn't, do whatever you want: plupload, swfupload, other abominations.
Comment #32
pp CreditAttribution: pp commented@rudiedirkx can you show me an example which I can select(not upload) multiple files?
pp
Comment #33
neurojavi CreditAttribution: neurojavi commentedSubscribing
Comment #34
moonberry CreditAttribution: moonberry commentedsubscribe
Comment #35
slashrsm CreditAttribution: slashrsm commented@moonberry, @neurojavi: Please do not post "subscribe" comments. Use "Follow" button instead.
More info: http://drupal.org/node/1306444
Comment #36
Dave ReidSmall patch enables the 'multiselect' flag to be set correctly in the Media browser. Pretty sure we have more work to do though.
Comment #37
Dave ReidMarked #1489370: no multiupload in node image fields as a duplicate of this issue.
Comment #38
Bernsch CreditAttribution: Bernsch commentedHi All.
Currently i use this Modules:
I have my Contentype with image field and the Media Plupload file selector - upload is unlimited.
So.. when i create a node and come to my media image-field widget. I have the button "select media".
I click it and i become my media_browser_plus with plupload widget. OK. I use any pictures. When i click continue - no image thums are in my media-field widget. The Button "add another item" appears instead of "select media". When i klick this Button - its the same problem - no images thumbs.
It doesn't works :-( ...
Any here the same problem?
Comment #39
agentrickard@Bernsch This patch is for 7.x.2, not 7.x.1. Please read the ticket details.
Comment #40
Bernsch CreditAttribution: Bernsch commentedok, i test this one with this modules:
I become a multiselect' flag. I have the button "select media".
I click it and i become my media_browser_plus with plupload widget. OK. I use any pictures. When i click continue - no image thums are in my media-field widget. The Button "add another item" appears instead of "select media". When i klick this Button - its the same problem - no images thumbs!
My question is: "What do i have to do to upload pictures as multiupload in a node image field" ?????
HELP ME PLEACE :-)!
Comment #41
Pomliane CreditAttribution: Pomliane commentedMarked #1406310: Batch uploading from content edit form as a duplicate of this issue.
Comment #42
Pomliane CreditAttribution: Pomliane commentedMarked #1489060: Plupload on the node edit page as a duplicate of this issue.
Comment #43
fangel CreditAttribution: fangel commentedI'm working on a generic, stand-alone Media selector widget module that alters the 'add more' button to popup the Media Browser, and then adds the selected items to the field. It's still missing some work (doesn't work with a fixed >1 cardinality, not unlimited; doesn't work with single-value fields; removing media could have a better UX, ...).
In theory similar to what #6 and #8 is talking about, except with a custom ajax-callback and ajax-trigger so it no longer has to trigger mousedown events to fire the ajax event. The AJAX-callback alters the form and form-state to include the newly selected files.
I'll polish it up some more and then publish a sandbox tomorrow. (It currently needs a patched Media, because the Views based tabs doesn't support multiselected, yet)
Comment #44
slashrsm CreditAttribution: slashrsm commentedGreat! Can't wait to see this.
Comment #45
fangel CreditAttribution: fangel commentedOkay, here's the first draft of the module I've done to add the functionality. Use the new 'Media Multiselect' widget for your fields. Any cardinality besides unlimited will result in a standard Media widget.
If you want Multiselect to work properly on the Views-based tabs, you need to patch Media with the patch provided by the module.
I does work kinda like the 'plupload integration' sandbox, except that it tries do less trickery like hiding the built in 'add more' button and replacing it with it's own, then triggering mousedown-events on the original, etc.
It could potentially be benifitial (as in, less code and trickery) to adapt the way that 'plupload integration' sends the new file ids over, except then you wouldn't know which were just added, so it can't add the 'ajax-new-content'-wrappers to enable show/hide effects.
http://drupal.org/sandbox/fangel/1652676
Comment #46
Andrea C CreditAttribution: Andrea C commented@fangel: do you think your module can also address this issue #1139266: specify directory path ?
Comment #47
fangel CreditAttribution: fangel commentedAndrea C: Possibly, but I don't see why that shouldn't be solved in Media on a per-field basis.
Comment #48
Andrea C CreditAttribution: Andrea C commented@fangel: what people is afraid of is that, also if you set a folder for images uploaded in a field, after a while you can have thousand of files in one folder, and this is something not desirable from a site or system administrator.
It would be nice to keep all the images "attached" to one node in a dedicated subfolder of the folder choosed on a per-field basis.
The subfolder could be named using a token variable or date-time of node creation
Comment #49
fangel CreditAttribution: fangel commentedAndrea C: I completely agree. But I believe it should be solved per-field not per-widget. And to support multi-select for inputs, you only need to change the widget, which is what my, and all the other attempts in this issue, have done.
Hence my "It should be solved in Media on a per-field basis".
Comment #50
Andrea C CreditAttribution: Andrea C commentedHi fangel,
Thanks for your time and answer.
I'm not so technical to understand how drupal works in deep.
I'm just one of those people who's not able to program on Drupal and wait for a solution to easily create an image gallery like the module Media_Gallery seems to do. The big problem is that all images are stored in the same folder.
I was just hoping your patch could be helpful for that.
Comment #51
fangel CreditAttribution: fangel commentedAndrea C: No problem. In case you're interested (and it might help explain why the change should be preformed elsewhere), here's the 3-line explanation to the Drupal Field system.
There are fields. Fields is is what contains the data, and governs things like "which file extensions are allowed", "maximum files size allowed" etc. This is where "which folder should the images be stored in" is relevant.
Then there are widgets. Widgets controls how you input data into the field. So if you selected one file at a time, or multiple files at a time is determined by which widget you use. The input-method doesn't have any control over how the field chooses to store the data that is input.
Lastly there are formatters. Formatters is what takes the data from the field and displays it to the user. This is where you control stuff like 'what size to display the user', 'should clicking on the images open them in larger formats', etc.
So when I say that changing the directory the files is stored in should be done on a per-field basis - because fields is what stores the data - and not on a per-widget basis - because widgets only control how you input the data - I hope this now makes sense to you.
Comment #52
Andrea C CreditAttribution: Andrea C commented@fangel: Thanks again. Your disposability to explain is really appreciated.
Comment #53
Bernsch CreditAttribution: Bernsch commented#50 |Posted by Andrea C
Tip/Information:
The MODULE Media Gallery Extra provides additional features and improvements for the Media Gallery module. Also including patterns (tokens) and root directory in the file upload directory where gallery media will be stored. :-)
Comment #54
Andrea C CreditAttribution: Andrea C commentedThank You Bernsch, I will continue the discussion in the dedicated issue #1139266: specify directory path
Comment #55
Dave ReidMarked #1692926: Media Browser not able to show multiple fids as a duplicate of this issue.
Comment #56
kiranch@vt.edu CreditAttribution: kiranch@vt.edu commentedHi ,
Thank you for linking my post to this post but i was referring to the code in media/includes/media.browser.inc which i thought was not working as written in the comments. I do not want any additional dialogs in the UI but i am more interested in how backend can handle taking multiple "fids" and presenting them. It is already said the comments in the code i pasted below that if one or more files have been selected, the files can be handled.
I am pasting some of that code below. I thought i would mention it more clearly
Do you think the above code (which was written in 7.1.2 version) cant handle multiple files ?
Do you know if there are any changes in the -dev version that can handle multiple files in back-end?
Many Thanks,
Kiran.
Comment #57
juves CreditAttribution: juves commentedHi
Is there a working solution with even basic functionality to this yet?
Comment #58
Jackinloadup CreditAttribution: Jackinloadup commented@juves See #45
Comment #59
fangel CreditAttribution: fangel commentedI have a sandbox-module that implements most of the ideas I've had while thinking of how to solve the multi-select issue. It's located at http://drupal.org/sandbox/fangel/1652676.
Note: it works best with a patch applied, and only works for unlimited-cardinality fields.
Comment #60
slashrsm CreditAttribution: slashrsm commentedThere is also a list of modules that implement this on Plupload's integration project page. It would be better to have this implemented in Media, but should work until it is not.
Comment #61
ParisLiakos CreditAttribution: ParisLiakos commented@Andrea C : posted a patch here http://drupal.org/node/1776300#comment-6534426
Comment #62
rdworianyn CreditAttribution: rdworianyn commentedI am not sure if anyone has taken a look at this or not, but the module, plup is a very easy to use solution for multi-image uploading. It even has drag n' drop functionality built in. I have looked through all of the alternatives out there and either I'm missing something, or this is definitely the best option available.
Comment #63
Bernsch CreditAttribution: Bernsch commentedSuch is the state regarding this issues in this contribution:
Allow selecting of multiple media items for a multi value media field in the same dialog
Which solution possibility should I pursue?
This one --> http://drupal.org/sandbox/fangel/1652676
Or there are other solving approaches or patches?
The multiupload problem in the media module is somehow a bit confusing...
Comment #64
ParisLiakos CreditAttribution: ParisLiakos commentedhttp://drupal.org/sandbox/fangel/1652676 is quite good, i run it myself in a production site:)
Comment #65
Sk8erPeter CreditAttribution: Sk8erPeter commented@Bernsch: I agree that this is a major priority issue.
Until a possible solution comes, I'm using Plup module: http://drupal.org/project/plup
I saw rdworianyn has already mentioned it, I agree with him, this is a great module, and provides a really comfortable UI: it provides the abilitiy to drag'n'drop the picture to its appropriate position when reordering, and shows a small but visible delete icon in the top right corner of every images, which is much nicer than the regular "Remove" buttons...
I think even Media module should learn from this module's great solutions. :))
Firstly I tried FileField Sources Plupload: http://drupal.org/project/filefield_sources_plupload, this is also a great module, but unfortunately one of my sites, it doesn't work correctly, the form doesn't get refreshed on the client side after uploading (maybe in connection with jQuery Update (the fresher jQuery) or Field group's accordions or I don't know: I couldn't trace the problem's source).
Comment #66
fangel CreditAttribution: fangel commentedrootatwc: Sorry to bug you, but since you "admit" to using my sandbox module, do you think I could get you to help review the patch in this issue: #1848506: Media Browser parameters reset after AJAX pagination - it prevents multi-selecting in the Media Browser on anything but the first page. (I'll reroll the patch later today, since it failed testing because it couldn't apply)
Comment #67
ParisLiakos CreditAttribution: ParisLiakos commented@fangel i have seen the issue, but didnt bother much since patch was not applying. i will review it when it passes bot;)
Comment #68
Sk8erPeter CreditAttribution: Sk8erPeter commented@fangel : I've just tried media_multiselect with Media 7.x-2.0-unstable7+2-dev, switched to "Media multiselect" widget and it doesn't work: after clicking "Add media" button, the Edit page just simply reloads without any JS error messages on the console... So it doesn't work at all, never has - at least for me. Any ideas?
(Btw. Epsa Crop module's "Manage image crops" link also disappears. :) )
Comment #69
fangel CreditAttribution: fangel commentedSk8erPeter: Create an issue on the sandbox issue-queue with info on browser, core+module versions and whatever else I need to try and replicate your problem, and I'll look into it..
Comment #70
Sk8erPeter CreditAttribution: Sk8erPeter commented@fangel: I'm sorry, I just tested on a fresh Drupal install, and it does work.
But it seems like I just don't understand the purpose of your module. When I have "Media multiselect" widget enabled, the node edit looks like this:
http://i.imgur.com/DOTFV.png
when changing it back to "Media file selector", and adding one more image, it looks like this:
http://i.imgur.com/UtU6y.png
I don't understand why it's more comfortable to use your module... I don't really see the real differences. Maybe you could post some screenshots to your project's page or sg. like that. Thanks in advance.
I'm looking for a solution to upload ~50 or more images at once (or even a hundred), but this one doesn't seem to help me in this. :) (or I just missed something)
Comment #71
fangel CreditAttribution: fangel commentedSk8terPeter: The difference is that you can select more than one image at a time in the Media Browser (and if you have plupload + multiform enabled, you can upload more than one file at a time too).
So you don't have to press "Add media" N times, just once and then select N files and press "OK".
Comment #72
Sk8erPeter CreditAttribution: Sk8erPeter commented@fangel : thanks, I'll try that with the earlier versions...
In the meantime, I realized that on the other Drupal site, where it DID work, I had only Media 7.x-1.2 installed... so no wonder it behaved differently than Media 7.x-2.0-unstable7+2-dev... So I reject what I said before :D, and maybe you should test your module with Media 7.x-2.0-unstable7+2-dev installed. Thanks in advance.
EDIT (after multiple edits):
OK, I tested this combo, and this is working perfectly:
Media 7.x-1.2 + plupload (7.x-1.x-dev [7.x-1.0+5-dev]) + multiform (7.x-1.x-dev) + media_multiselect + "Media multiselect" widget
Cool!!! Great work, fangel!
I'll test it also after upgrading to Media 2.x and plupload 7.x-2.x-dev, I'm curious... :)
EDIT 2:
it seems to work with media 7.x-2.0-unstable7+2-dev + media_multiselect 7.x + multiform 7.x-1.0 + plupload 7.x-1.0+5-dev too.
One really frustrating problem: when trying to upload multiple images at once, and trying to upload an unsupported file type too (which is e.g. not an image) like this:
http://i.imgur.com/DJ5Y9.png
after clicking "Next", I get an error message that the given file could not be uploaded, and all the images are "lost" even when I tried to upload like 30 images at once. This is not too good, the unsupported file should just not be uploaded, and that's all, but this should not affect the rest of the files.
Look:
http://i.imgur.com/qdgmp.png
Is this problem in connection with your widget or with Plupload module?
Comment #73
Bernsch CreditAttribution: Bernsch commentedHi Sk8erPeter,
I have the test carried out with the same modules as you.
I become a multiselect' flag. I have the button "select media".
I click it and i become my media_browser with plupload widget. OK. I use multible pictures. I use the alt an title tags. When i click continue - no image thumbs displayed. The button "select media" is displayed again. Although the pictures are uploaded but not displayed in my article! I can see the images in content/media!
I test in firefox, chrome and IE9.
hm...i dont understand this..
Comment #74
Sk8erPeter CreditAttribution: Sk8erPeter commented@Bernsch: the truth is that it only works for me on fresh Drupal installs. I tried to make it work on two other sites, and the "Add media" button did nothing at all, and there were no JavaScript errors either. On one of the sites, I have multiple nested field groups, I don't know if it's related at all.
Can you also test it on a fresh Drupal site?
And can you post a screenshot of the error? I don't know if fangel will see it, but maybe we should continue this discussion about his module on the Issues for Media Multiselect page. :)
Comment #75
fangel CreditAttribution: fangel commentedYes, please do take any issues to the proper issue queue. If you can find the specific modules that breaks my module, please list them there. But yes, everything is developed on a clean git-checkout of Drupal, Media, File Entity, etc - and then tested on our production site with ~50 or so contrib modules...
Comment #76
Sk8erPeter CreditAttribution: Sk8erPeter commentedIn the meantime, I realized that the problem I mentioned in #68 is related to the new ImageField Tokens 7.x-1.x-dev.
When disabling ImageField Tokens, Media multiselect works correctly!
So I created an issue related to this problem:
http://drupal.org/node/1859976#comment-6816610
Comment #77
mglamanHere is a patch I whipped up to bake in support for multiselect within the media browser on fields. This is against the latest HEAD which implements the newly formatted Media field widget. The Media Multiselect sandbox was broken by the field widget change - see #2216273: Latest media changes break the multiselect.
One of the issues is how
media_attach_file()
checks $_POST data. I don't know how much I like the fact my patch manipulated $_POST info, but unless Media is updated to stash data in $form_state, it's the only way.Comment #84
mcrittenden CreditAttribution: mcrittenden commentedA code comment for these lines with an example of $upload_name and $element['#parents'] might be helpful - seems kind of magic-ish just from the code.
Same here - comments explaining why would be helpful, otherwise I could see this being misunderstood and broken in the future.
Maybe mediaFileFid would be more descriptive?
Comment #85
mglamanThanks, mcrittenden. I'll update with comments. Essentially Media is checking $_POST['media'][FIELDNAME_LANGCODE_CARDINALITY]. Those tidbits reconstruct that and add the additional required field name values so they can be processed.
Like I said, it'd be better if only had to manipulate $form_state to add them in, but the field value callback pulls directly from $_POST.
Comment #87
shortspoken CreditAttribution: shortspoken commentedThanks @mglaman, I just tested the patch with Media 7.x-2.0-alpha3+98-dev and its working! Didn't test it with latest dev though. Anyone?
Comment #88
ahillio CreditAttribution: ahillio commentedWow, patch from #77 worked on Media 2.0-alpha4+11-dev thanks :)
Comment #89
ahillio CreditAttribution: ahillio commentedPatch from #77 indeed is using plupload for uploading to image fields, it uploads and saves them successfully.
Should this load a multiform for editing all the new file entities instead of going straight back to node edit form?? This would make it much easier to add alt tags or taxonomy terms to the images, rather than having to do them one-by-one from the node edit form.
Thanks again!
Comment #90
mglamanfirestk, media_multiselect worked the same way. It inserts directly. The same as when adding an individual item. You have to go back and edit.
And I promise to re-roll patch w/comments. The patch only failed because test bot was having issues.
Comment #91
ergophobe CreditAttribution: ergophobe commentedJust to add that while it might be nice to have multiform as firstek suggests, I think this patch already is such a huge advance that I would love to see it committed as is and have multiform support added as a separate issue.
Thanks mglaman - this is so great.
Comment #92
ergophobe CreditAttribution: ergophobe commentedConfirming that I applied this to the 7.x-2.0-alpha4 and the current dev (30 Nov 2014) and the patch applies fine.
When I select the Media Browser widget, voila! Perfect. It gives me everything I want and have been hoping for from the Media module forever.
mglaman, you're a saint. This simplifies things so much over every other solution I've tried and for me works perfectly out of the box.
Comment #93
akalam CreditAttribution: akalam commented#77 works perfect with the following configuration:
media-2.x-dev
media_bulk_upload (and multiform module)
plupload module and library
file or image field with "media browser" widget and "number of values" set to "unlimited"
Thanks!
Comment #94
Ravenight CreditAttribution: Ravenight commentedI confirm this works as well.
applied this to the 7.x-2.0-alpha4
YAY!
Comment #95
rcodina CreditAttribution: rcodina commentedI also confirm that patch #77 works for me too. My environment:
Media (media) 7.x-2.0-alpha4+11-dev
Plupload integration module (plupload) 7.x-1.7
Multiple forms (multiform) 7.x-1.1
Also I have:
-Module "Media Bulk Upload" enabled
-Image field with: a) Unlimited values b) Media Browser widget
-No need of module Media Multiselect
Maybe we can mark this issue as RTBC, couldn't we? I think is a key feature for this module so it should be commited ASAP.
Keep up the good job @mglaman Thanks!
Comment #96
rcodina CreditAttribution: rcodina commentedI think this issue should be RTBC.
Comment #97
mglamanThanks everyone for the great feedback! I hate to do it, but I need to roll this back from RTBC to CNR because I never addressed the comment issues in #84
Here is updated patch with comments detailing the reconstruction of the field name, langcode, and delta (ex: field_myfield_und_0) to allow the multiselect magic to work.
Also,
I think mediaFileValue makes more sense, as it can be a map or single value.
Comment #98
jeffschuler#97 is working great for me!
Thanks for all of this hard work. :)
Comment #99
mcrittenden CreditAttribution: mcrittenden commentedThanks!
Comment #100
ergophobe CreditAttribution: ergophobe commentedJust updated to Panopoly 1.14 and updated the Media module to alpha4+11dev and mglaman's patch is still working great.
I have got a pretty nasty setup here in terms of testing - Panopoly + Organic Groups + running with Zurb Foundation (though Responsive Bartik for admin). I've had a lot of issues wth stability and conflicts with other solutions. This patch is very solid so far and I have maybe a couple hundred automated Selenium tests and as near as I can tell, this patch is not causing any issues.
It would be great to see this committed!
Comment #101
Rob C CreditAttribution: Rob C commentedRTBC for me. Tested this with a couple sites now that used to work with media_multiselect (sandbox). Switching this just works great.
Comment #102
slippast CreditAttribution: slippast commentedOkay, so I just installed this patch. It's a great. However, if you have Image Javascript Crop module enabled this functionality is broken. What happens is that when you are creating new content the image/file fields only show a text area and a button labeled 'attach'.
I used patch #15 from the following thread to fix the problem and get Image Javascript Crop working again: https://www.drupal.org/node/2196011
To mglaman: patch #97 works very well. What a massive improvement to the Media module! I've wanted this functionality for several years now. Thank you so much!
Comment #105
mglamanUpdating patch to fix tests...
Comment #106
mglamanHere's first attempt to fix tests, at least one fixed. Other test randomly fails locally still, but not repeatably :/4
I'll keep digging, but it seems
$out has the proper field values in the HTML, but it doesn't seem to be saving correctly in tests.. but fine everywhere else.
Comment #108
ergophobe CreditAttribution: ergophobe commentedThanks for sticking with this mglaman
Comment #109
drupal a11y CreditAttribution: drupal a11y commentedBIG HUGS & THANKS for the patch! Would be great to have it applied in the next dev-version.
my setup:
Media (media) 7.x-2.0-alpha4+14-dev (2014-Dec-17)
Plupload integration module (plupload) 7.x-1.7
Multiple forms (multiform) 7.x-1.1
File Entity 7.x-2.0-beta1+12-dev
Also I have:
-Module "Media Bulk Upload" enabled
-Image field with: a) Unlimited values b) Media Browser widget
Comment #110
sense-design#106 works great for me
Comment #113
dmsmidt#106 really great!
Comment #114
mglamanUpdate: been busy with holidays and work. Dedicating sprint weekend to getting this patch to pass tests so we have an epic win on Media & D7
Comment #115
sense-design@mglaman: Would be great
Comment #116
mglamanKind of at a loss.
$_POST in media_field_widget_process_multiple() during test
Form state snippet after _form_builder_handle_input_element() set's values.
The form's setting the value, but when the test reloads the node it isn't set for unlimited cardinality fields. Will pick this up later.
Comment #117
drupal a11y CreditAttribution: drupal a11y commentedWith File Entity 7.x-2.0-beta1+13-dev and patched Media (media) 7.x-2.0-alpha4+14-dev (2014-Dec-17) the patch does not work anymore.
You can upload multiple files but only the 1st one is attached.
Comment #118
drupal a11y CreditAttribution: drupal a11y commentedAnother usability issue I´ve spotted is that the uploaded files are then attached in a "reversed order" -> first uploaded file is attached last.
In my opinion the order should be the same as in the upload dialog.
Comment #119
mglamanmori, thanks for heads up! Maybe that's my issue - changes in File Entity. I'll compare what our product is using + patch against latests in both modules.
I'll also investigate #118.
Comment #120
ergophobe CreditAttribution: ergophobe commentedI don't think recent changes to File Entity are the issue. Your patch is still working great for me with recent versions of everything
- File Entity 7.x-2.0-beta1+12-dev (2014-12-03)
- Media 7.x-2.0-alpha4+11-dev (2014-11-19)
- CTools 7.x-1.6-rc1 (2014-12-19) with patch 2119357-6_0.patch #2119357: Undefined index in ctools_argument_entity_id_context()
- Panels 7.x-3.4+19-dev (2014-12-23)
- Panelizer 7.x-3.1+59-dev (2014-06-03)
- the full Panopoly stack
The only thing I have that is older than mori's setup is Media. I'm not sure how much changed between alpha4+11 and alpha4+14
I have a pretty extensive set of Selenium tests that I run on each upgrade and they are all still passing fine.
Comment #121
stijn.blomme CreditAttribution: stijn.blomme commentedI can confirm the patch from #106 works on the latest media dev release.
- media 7.x-2.0-alpha4+23-dev
- file_entity 7.x-2.0-beta1
- plupload 7.x-1.7
- multiform 7.x-1.1
-> Do not forget to enable the media_bulk_upload sub module that comes bundled with media!
Comment #122
dtarc CreditAttribution: dtarc commentedI have been using the patch from #106 but file uploads have been failing for larger files. Investigating more, tnightingale discovered that file upload chunking was not happening. Presumably this is because neither the plupload module nor the patch to media sets the default #plupload_settings as defined in the plupload module README.
I'm not sure if this should be the responsibility of media or plupload. I have opened an issue on the plupload module queue to check (#2420749: Documented default for chunk_size does not match value in code).
In the meantime, here's the patch from #106 adjusted to also include setting the chunk_size setting to 20mb.
Any thoughts on whether this should go into media_bulk_upload or plupload? I suppose the chunk size as well as some of the other #plupload_settings could be made into variables in media_bulk_upload. This might be easiest for sites using plupload with media.
Comment #123
dtarc CreditAttribution: dtarc commentedRe-rolling the patch in #122 to fix a syntax error.
Comment #124
dtarc CreditAttribution: dtarc commentedComment #127
mglamandtarc can you please post interdiffs of your patches versus what I had.
I'm hiding the last patch that contains this. While I dig, I think it should be part of it's own issue and not part of this patch/functionality. That portion should go into media_bulk_upload, but I feel it's an issue outside of this one's scope (and possibly a true bug that needs fixing.) We haven't experienced, and we support 100MB+ uploads.
You could have an unlimited cardinality field without bulk upload. This simply allows multiple selection from the library. That's the goal of this patch, IMO.
I hid the other patches, just to keep this organized (not to be rude/disrespectful.) Willing to discuss in IRC as well!
Comment #128
ergophobe CreditAttribution: ergophobe commentedTo answer dtarc's question, I think his patch should be part of plupload, not part of this patch.
The plupload module gets used in conjunction with other modules, not just Media and so thsi problem should be fixed once, in onc place, rather than in every module that invokes plupload.
Not to mention that many, many people would really love to see Matt's work get committed, though obviously one of us needs to find the time to figure out why the automated tests are failing.
Comment #129
dtarc CreditAttribution: dtarc commentedI can post an interdiff later today. The only difference was the function shown, media_bulk_upload_element_info_alter().
I don't want to hold up this patch with an indirectly related issue and agree that this really should be fixed in plupload.
Uploads started failing once file size got close to 1GB. 500MB files worked fine. I'm not sure at exactly which size file upload started failing--but we determined that the upload failures were due to file upload chunking not happening. It could be that failures are related to fastcgi, which we are using. However once the chunk_size setting was included, file uploads have been successful.
I just wanted to post this here as well since media users will have the expectation that this patch allows plupload with all its expected functionality. Also I wasn't sure if this could affect the failing tests.
I'll follow up in the plupload module issue.
Comment #130
ergophobe CreditAttribution: ergophobe commentedI added that issue as a related issue bother here and there so it shows up in the "related" sidebar.
Comment #131
dtarc CreditAttribution: dtarc commentedI think this is indeed a bug for plupload (even if just a documentation bug) and I have uploaded the linked issue in the plupload module queue.
I didn't mean to derail this issue as I'm also looking forward to seeing the work committed soon. Please disregard the patches in #122 and #123. I thought this issue was more about plupload integration in general than about using it for multiple files. The use case we need plupload for is handling large file upload via chunking, so I suppose that's where my focus was.
I think once this is committed, many media users will add plupload, so hopefully something gets resolved in the plupload queue. It was a confusing issue to sort out and I don't think our configuration is uncommon. Jacking up the php.ini vars seems to be a common solution to load issues on drupal sites.
In the meantime, this is how we are getting around the issue:
Again, sorry for the tangent.
Comment #132
mglamandtarc, no problem! Multiple selection, bulk uploading, it's all a large system that is rough. Appreciate bringing it to attention, nonetheless, as it'll affect our product.
To recap, though: This patch is failing because multiple select is failing - not upload. The unlimited cardinality field is failing read the POST being sent from modal, even though it works manually and through debugging simpletest. (See #116)
Still trying to figure out why. Debugging simpletest isn't easy, because the process forks off on submit and I can't debug it :(
Comment #133
mglamanChanging back issue summary.. comment changed it.
Comment #134
uniquename CreditAttribution: uniquename commentedI fixed #118 with a simple mediaFiles.reverse(); in media.js line 77.
Comment #135
izmeez CreditAttribution: izmeez commented@uniquename Do you have a modified patch and interdiff to offer?
Comment #136
uniquename CreditAttribution: uniquename commented...sorry was lazy ...here is a patch. But I'm not sure if this is the right approache, cause I don't know why the files are in the wrong order.
Comment #137
PI_Ron CreditAttribution: PI_Ron commentedMind blown. After years of tangling with media_multiselect... Mind blown.
Thank you for all who brought this patch to fruition.
FYI:
media_browser_plus-7.x-3.x-dev
media-7.x-2.0-alpha4+26-dev (Patched with #136)
multiform-7.x-1.1
plupload-7.x-1.7
Comment #138
garbo CreditAttribution: garbo commentedFor me it works as well with patch #136.
But I do need the media_bulk_upload module (part of the media module pack) together with the modules listed by Pi_Ron at #137.
Comment #139
msound CreditAttribution: msound commentedHere is an interdiff between #106 and #136
Comment #140
hefox CreditAttribution: hefox commentedshould this be set back to needs review/trigger testbot?
Comment #141
mglamaneh, why not hefox! $_POST is getting tumbled away in tests. I can't keep the xdebug going because it forks off. basically can't see why tests are failing, but it works in production.
Comment #145
AnybodyWas somebody able to find out why this test is unhappy:
Media file field validation tests (MediaFileFieldValidateTestCase) [Media]
I'm also having a look...
Comment #146
AnybodyI can confirm the patch from #136 works absolutely great in production. I've got no clue why the test fails. Perhaps one of the module developers of Media module may have a look?
This patch is great and a great benefit for the module! :)
Comment #147
mglamanSomething goes away during the $_POST. I have no idea. I wish I could even begin to understand why the tests fail. Harder to get the tests figured out than actually getting the solution in the core of the module. :/
Comment #150
rcodina CreditAttribution: rcodina commentedI can also confirm that patch on #136 works for me. My full setup:
Media (media) 7.x-2.0-alpha4+37-dev
+allow_selecting_of-951004-136.patch
+media_wysiwyg-ckeditor-module-browser-tabs-2333855-7.patch
+media-ckeditor4-media-plugin-2177893-14.patch
Plupload integration module (plupload) 7.x-1.7
Multiple forms (multiform) 7.x-1.1
CKeditor 7.x-1.16
+Issue_2454933_0.patch
Comment #151
JurriaanRoelofs CreditAttribution: JurriaanRoelofs commentedI can also confirm patch #136 works great, both in a production site on media dev and in my Drupal distribution against media alpha 4.
Comment #152
mallezieIt seems the test fail is caused in MediaFileFieldValidateTestCase in the testRequired test.
At line 1071 a file get's added to the (multifield).
Adding an extra test for that
as done on the single field (see line 1052) even succeeds.
However when you add debug($node) afterwards. The file doesn't seems to be added to the testnode.
My wild guess would be that some extra parameters need to be added to the $this->drupalPost("node/$nid/edit", $edit, t('Save')); call inside function attachNodeFile(), to correct the post request used.
Comment #153
maxplus CreditAttribution: maxplus commentedHi,
I can confirm the patch from #136 works for me:
- media 7.x-2.0-alpha4+37-dev
=> with media_bulk_upload sub module enabled
- file_entity 7.x-2.0-beta1
- plupload 7.x-1.7
- multiform 7.x-1.1
- patch for CKeditor: https://www.drupal.org/node/2455391
Now I can
1. upload multiple items at once, using plupload
AND
2. select multiple items at once for a multi image field
Very nice feature, thanks!
Comment #154
Martin. CreditAttribution: Martin. commented#136 works as long as there is no other unlimited field on that entity. I have an unlimited field collection field and when I click "Add new" for that field, I get an error that reports my imagefield is required (although it is filled) and generates another image upload field at the bottom. The image upload widget was plupload but it also doesn't work with the regular upload widget. I am experiencing exact same situation as described here https://www.drupal.org/node/2333247 . That issue is marked as duplicate of this. Has anyone experienced the same thing ? Is there a workaround or permanent fix for this?
Comment #155
ergophobe CreditAttribution: ergophobe commentedMartin - I opened the issue you reference and for me it is fixed if you are on recent dev releases of Media and File Entity and current releases of Panels and Fieldable Panels Pane.
Are you on a recent Media version (say 7.x-2.0-alpha4+37-dev) and at least the current release of File Entity?
Are you on releases of Panels, CTools, Fieldable Panel Panes, File Entity, Media and Panelizer that are more recent than Feb 14, 2015?
Comment #156
KingdutchIt's been said many times but the patch from #136 works in production.
- Media 7.x-2.0-alpha4+37-dev
=> Bulk Upload sub enabled
- File Entity 7.x-2.0-beta1
- Plupload 7.x-1.7
- Multiform 7.x-1.1
Comment #157
mallezieIt is indeed confirmed this patch works. (Note: i also use this in production).
However this won't be merged until the test-fails are resolved. This needs changes in the tests, to adjust the post-test to work correct.
(Or this should go in with the tests removed, but that also doesn't seem a very good idea).
Comment #158
cthshabel CreditAttribution: cthshabel commentedJust wanting to confirm this works with the exact configuration as Kingdutch says in #156. Thanks for putting the versions for everything. I had a few development branches and things had changed and weren't working. Looking great. Amazing work.
Comment #159
jatinkumar1989 CreditAttribution: jatinkumar1989 commentedHi Everyone,,
I used same as #156, with patch in #136.
- Media 7.x-2.0-alpha4+37-dev
=> Bulk Upload sub enabled
- File Entity 7.x-2.0-beta1
- Plupload 7.x-1.7
- Multiform 7.x-1.1
But its not working for me.
Any help plz,
My requirment is to upload multiple files at a time using media browser.
Thanks
-Jatin
Comment #160
jatinkumar1989 CreditAttribution: jatinkumar1989 commentedHI,
Now i triend on fresh drupal,
using the following modules:
- Media 7.x-2.0-alpha4+37-dev
=> Bulk Upload sub enabled
- File Entity 7.x-2.0-beta1
- Plupload 7.x-1.7
- Multiform 7.x-1.1
and apply patch #136.
Its working (multiple selection at a time) when i select cardinity = UNLIMITED, But when i select cardinity= 3, it behave like single upload as a time.
any suggestion. ?
Thanks
-Jatin
Comment #161
mglamanmail2jatingarg , that is how its intended to work. This issue is on multiple selection from library, not upload.
Comment #162
thomas.lobjoie CreditAttribution: thomas.lobjoie commentedHi,
I just achieved to have the multiselect to works with Media 7.x-2.0-beta1+1-dev
Unfortunataly I had to revert a revert from the 14th of July 2015:
http://cgit.drupalcode.org/media/commit/?id=7c0f5bc
Basically, the first time I opened the modal media browser, all was fine, but the second time, 2 modals were loaded... and I had the message "You have not selected anything!"
That's why I had to revert that line:
$(selector, context).children('.browse').bind('click', {configuration: configuration}, Drupal.media.openBrowser);
to:
$(selector, context).children('.browse').once().bind('click', {configuration: configuration}, Drupal.media.openBrowser);
Now, I would like to understand why this line was reverted with this patch, and if I am exposed to other problems because of it... Devin Carlson, any ideas?
Thanks
Comment #163
AnybodyWell, from my point of view the .once() makes sense because the bind may be called several times during ajax calls and also the selector may be contained in the selector more than once during these calls. So the problem and result seem logical.
I agree we should find out if the removal of once was just a cleanup or had deeper reasons.
Comment #164
mallezie@thomas.lobjoie I cannot reproduce the issue you're describing here, however this seems unrelated tot the multiselect feature. Could you file a seperate issue for your issue?
The latest patch still aplies to the latest media-dev-release, and still works. (However tests are probably still the same problem).
Comment #165
thomas.lobjoie CreditAttribution: thomas.lobjoie commentedThanks for your answer Anybody...
I've sent a direct message to Devin (who reverted this line on the 14th of July) as I don't think he is listening this thread... No answer so far. I'll let you know.
Comment #166
thomas.lobjoie CreditAttribution: thomas.lobjoie commented@mallezie: OK, I'll try to reproduce this on a fresh install and will let you know...
Comment #167
PI_Ron CreditAttribution: PI_Ron commentedHere is the issue of duplicate media browser windows https://www.drupal.org/node/2534724#comment-10164088
Comment #168
devad CreditAttribution: devad commentedThere is an admin path issue for those who try to use multiple selecting together with Administration Language module.
It took me a while to discover it: #2401989: Add media/ajax/* as administrative path
Patch #2 is outdated, so quickfix is adding media/ajax/* path to the list of administrative pages at: admin/config/regional/language/admin_language
Administration Language related issue: #2401955: Selecting media causes Drupal to save a node due to translated button value
Comment #169
Proteo CreditAttribution: Proteo as a volunteer commentedHi, another confirmation that patch in #136 works wonderfully against Media 7.x-2.0-beta1. There's any hope it gets commited at some point?
Comment #170
ergophobe CreditAttribution: ergophobe commentedProteo - it can't get committed until it can pass testing without errors.
Unless someone can create a viable test, this will never get committed. Which is a bummer in this one case, but good for Drupal overall.
Comment #171
mglamanUpdate on my patch from #106. I am no longer on the project which allowed me to get this solution conjured up and a working patch submitted. I've tried debugging the tests to figure out why they fail (maybe it's just SimpleTest?) I'd love to see the tests pass and this committed, but I do not have the current bandwidth available and hope others can join in and help solve this!
#169 - Proteo it's being used in production for over a year, just hold onto patch.
I won't give up, though. Anyone interested to collaborate more on this ping me in IRC or D.o contact form.
Comment #172
Proteo CreditAttribution: Proteo as a volunteer commentedThanks for your comment mglaman, it's good to know you're still around. As you mentioned, I've been using the patch on several production sites for a while, and it's been working great.
Comment #173
danymill CreditAttribution: danymill commentedHi. #136 works fine, but only for fields. How to make multiselect began to work in the editor CKEditor (Media + WYSIWYG)?
Comment #174
siramsay CreditAttribution: siramsay commentedThis maybe related to Temp file error on upload for Plupload integration modulehttps://www.drupal.org/node/1184850
see also comment #181
original issue encountered and reported below
-----
I have attached 2 screenshots to show that when I first used the patch at #136 it failed.
it maybe related to #145 test
I have since applied the patch to other installs with no problems
what I did
As the screenshots show, after the second try the uploaded file names were auto incremented and haven't had the problem persist. Maybe just a caching issue?
sorry not much help really , I will try and replicate and report back.
contact me if you want.
Comment #175
siramsay CreditAttribution: siramsay commentedsorry didn't mean to hide that file
Comment #176
Jean Gionet CreditAttribution: Jean Gionet commentedanother confirmation that patch in #136 still works flawlessly with Media 7.x-2.0-beta1
Comment #179
thursday_bw CreditAttribution: thursday_bw at Catalyst IT commentedI have made an ammendment to allow_selecting_of-951004-136.patch so that multiple files can be upload when the cardinatlity is set to not only unlimited but also > 1.
It's not perfect, as the plupload form still allows unlimited uploads, but the multiple form field only accepts the cardinality number to be applied.
Comment #180
izmeez CreditAttribution: izmeez commented@thursday_bw can you also add an interdiff, thanks.
Comment #181
siramsay CreditAttribution: siramsay commentedthe issue I describe in #174 above may in fact not be related directly to this patch.
I have encountered the same problem on another install periodically and even though it is happening with the bulk media upload on a multi upload field using this patch it may in fact be a Plupload integration module issue as reported here https://www.drupal.org/node/1184850
it happens when the files uploaded are large, in my case not that large (>~500KB)
In this case however the files were uploaded and it also left a undefined media asset in the media file list. (previously the files were not upload as they were duplicates)
this is the message I get X 4 (the number of files trying to upload)
other than this issue I can report it works, so you can possibly disregard my rambling:) useless of course someone out there can see a connection between the reported problem and how the patch is implemented i.e in the modal window
Comment #182
seanBI can confirm the issue mentioned in #162 but saw that the commit producing this error was already reverted in the latest dev.
With that being said, installing the latest dev with the patch in #136 fixes the issue for me!
Not sure why the test is failing, but it all seems to work here!
Comment #184
valderama CreditAttribution: valderama at Form & Code GmbH commentedI finally managed to get the patch from #136 to work with media 2.x-dev. In my case the admin_language module was causing problems - after disabling it, selecting multiple media files works fine.
Comment #186
heyyo CreditAttribution: heyyo commentedI could successfully upload multiple images in a image field handle by media.
But after selectionning several pictures and click submit, only my first image clicked is retained.
I'm using this module list:
File Entity 7.x-2.0-beta2+13-dev
Media 7.x-2.0-beta1+9-dev
Media Bulk upload 7.x-2.0-beta1+9-dev
Plupload 7.x-1.7+5-dev
With patch #136
Any idea how to solve this ?
EDIT: Reverting Jquery to 1.4 for admin pages fixed this issue, I was using 1.7.
Comment #187
jurgenhaasI can confirm the combination described by @heyyo does work for me too. Even better, it also works with media 7.x-2.0-beta2.
Comment #188
mpotter CreditAttribution: mpotter commentedPatch #136 works for me with 7.x-2.0-beta2 BUT I also need the fix for multiple media browser popups mentioned in #167 AND I need to revert the commit as mentioned in #162.
Without these extra changes I was seeing odd behavior where the first time I used Media Browser and clicked an image it was immediately using the image and closing the dialog and not waiting for the Submit button. But the second time I open Media Browser I could click on multiple images correctly.
The fixes from #167 and #162 fixed this for me.
Comment #189
izmeez CreditAttribution: izmeez commentedPardon me, but to keep moving forward shouldn't the comments be on using the patch(es) with the current dev release? Yes, I know it is a moving target but it is already 8 commits ahead of beta-1.
Comment #190
ann b CreditAttribution: ann b commentedThe following configuration worked for me:
media -- 7.x-2.0-beta1
file entity -- 7.x-2.0-beta2
multiform -- 7.x-1.1
Plupload 7.x-1.7
Media Bulk Upload sub enabled
patch #136
*
But when I updated the media module to 7.x-2.x-dev (10/1/2015) and re-applied patch #136, the widget stopped working. The plupload drag and drop area no longer displayed.
Comment #191
jsst CreditAttribution: jsst at Ibuildings commentedI've rerolled patch #179, it's content-wise the same but diffed relative to the module directory so it can be applied using drush-make.
I can also confirm #179/#191 solves this issue for us using media-2.x-dev.
Comment #192
legolasboComment #195
fonant CreditAttribution: fonant at Fonant Ltd commentedWorking for me:
media: 7.x-2.0-beta1, with media_bulk_upload enabled and patch #191
file_entity: 7.x-2.0-beta2
multiform: 7.x-1.1
plupload: 7.x-1.7 and version 1.5.8 of library
Comment #196
jeffschuler#191 is working well with the latest Media 7.x-2.0-beta1+9-dev (2015-Oct-01).
(Same versions of file_entity, multiform and plupload as fonant in #195.)
Comment #197
jsst CreditAttribution: jsst at Ibuildings commentedThis patch is based on #191 but modifies media.test:
All tests should now pass.
Comment #198
mallezie@jssst, thanks this seems great! Tests pass now!
Comment #199
tapscolaM CreditAttribution: tapscolaM commented@jssst a big win on this one, thanks!
Comment #200
mglamanjsst, thanks for fixing my test <3 you're amazing.
Comment #201
ergophobe CreditAttribution: ergophobe commentedjsst - thanks!
Finally, a working test and a patch that can get committed. Awesome work and, again, thanks so much to mglaman for all his work on this.
This thread is "only" five years old :-) and one year since Matt jumped in on an issue that had been dead for two years and finally gave us all a working solution to a persistent problem. Thanks again!
Comment #202
Nchase CreditAttribution: Nchase as a volunteer commented#197 works for me.
Comment #203
Khumbu CreditAttribution: Khumbu commentedI can confirm that this works like a charm...
Great work..kudos..
Comment #204
gregori.goossens CreditAttribution: gregori.goossens as a volunteer commentedHi all,
i have some sort order problem when i upload several files at once.
New files are "ramdomized".
it seems came from line : 296 in media.field.inc (see my config below).
$element[] = $element[$element['#file_upload_delta']];
in fact, for each new file it create a copy of default new item array but keep the same #weight property value, and when we call element_children drupal try to sort on #weight property with uasort.
i tried with follow line instead and it work for me :
$element[] = array_merge( $element[$element['#file_upload_delta']], array('#weight'=> ($element['#file_upload_delta'] + $i +1)));
Then files are now not ramdomized but in reverse order.
So i remove javascript reverse instruction (in don't understand why exist). in media.js line 78 : mediaFiles.reverse();
After this 2 modifications, it seems to work well.
My config :
media: 7.x-2.0-beta1, with media_bulk_upload enabled and patch #197
file_entity: 7.x-2.0-beta2
multiform: 7.x-1.1
plupload: 7.x-1.7 and version 1.5.8 of library
Drupal 7.41
PHP 5.5.30, mac os x 10.11.2
jsst, thanks for your patch.
Comment #205
jsst CreditAttribution: jsst at Ibuildings commentedHi Gregori,
let's first clear this up: user 'uniquename' is the original author of this patch. We're just refining his work.
Your suggestion to explicitly set the weight of new elements makes sense. Not defining a weight can cause a random order, according to the docs on uasort (which element_sort uses):
About the reversed order of the selected files, I get a reversed order too which indeed seems to be fixed by removing mediaFiles.reverse(). Not quite sure if we're breaking another use-case by removing the call because the line was added in comment #134, in response to #118 which is a report about the selection being reversed. Maybe not setting the weight was the problem in #118 to begin with.
I've updated the patch to include these two new behaviours.
Feedback is appreciated!
Comment #207
mglamanjsst, can you post an interdiff so we can see what changed and why test failed?
And, I normally don't say this, but I poured a lot of blood into this. Original solution is from #97. uniquename's patch helped solve ordering.
Comment #208
ergophobe CreditAttribution: ergophobe commentedI saw that - mglaman, you are no matter what a hero to those of us who have been following this for years! You deserve some sort of award!
Comment #209
uniquename CreditAttribution: uniquename commentedWow, I'm still getting mentioned here;-) Like I said in my comment "But I'm not sure if this is the right approache, cause I don't know, why the files are in the wrong order." It was really like a quick fix to get it working, without diving into it...
Anyway, all kudos, and that are a lot, go to mglaman! I just helped out a bit...
Comment #210
JayDarnell#197 works for me. Thank you so much everyone!
media: 7.x-2.0-beta1, with media_bulk_upload enabled and patch #197
file_entity: 7.x-2.0-beta2
multiform: 7.x-1.1
plupload: 7.x-1.7 and version 1.5.8 of library
Comment #211
KingdutchThe patch in #205 fails because it is missing the update to the media.test
(This was uncovered by a quick find for $edit in the latest patch).
Sadly I don't have a Drupal 7 install lying around at this moment to fix that. Manually editing patch files also didn't feel like the right way to go.
Comment #212
oranges13Patch from #197 applies and works for my use case. Thank you.
Comment #213
friera CreditAttribution: friera as a volunteer commentedPatch #197 works for me. Thanks!
Comment #214
Hoza CreditAttribution: Hoza commentedPatch #197 was working for me as well on Media 7.x-2.0-beta1. The update on May 30 for *-beta2 broke this, however.
I tried to quickly run through the patch (manually.. because I'm not versed in how to do this stuff, tbh), which seemed to work at first, (drag/drop into multi field and uploads worked) but then the edit page only showed the first image during my first test. I don't have time to try harder right now, so I just reverted to beta1.
Just a note to beware of upgrading to Media 7.x-2.0-beta2 without a new patch for this issue.
...really sorry I'm not better at this stuff or I'd just go through and fix the patch, etc. I'll take a stab at it after this project I'm crunching on if nobody else has solved by then.
edit: Oops.. forgot that I also upgraded File Entity to 7.x.2.0-beta3 at the same time. However, I only rolled back Media to beta1 and it seems to be working. I did not roll back File Entity since #197 doesn't patch that (obv.). HTH.
Comment #215
fonant CreditAttribution: fonant at Fonant Ltd commentedConfirmed that Media 7.x-2.0-beta2 breaks multiple file uploads.
Comment #216
spgd01 CreditAttribution: spgd01 commentedConfirm Media 7.x-2.0-beta2 breaks multiple file uploads.
Comment #217
devad CreditAttribution: devad commentedJust a note... it may help someone...
I have upgraded to D7.44 and Fie Entity 7.x-2.0-beta3 and I have kept Media 7.x-2.0-beta1 (not upgrading to beta2) and Multiple upload still works. So, it is confirmed once more that it is Media 7.x-2.0-beta2 which breaks multiple file uploads.
Comment #218
oranges13Here's an updated patch rolled against beta2. Should work!
Comment #219
oranges13Crap! That included the comments from drupal's packager. Updated patch attached.
Comment #220
Proteo CreditAttribution: Proteo as a volunteer commentedThank you very much oranges13.
Tested the patch from #219 in a couple of sites after updating to Media 7.x-2.0-beta2 and File Entity 7.x-2.0-beta3 and it worked great.
Best regards.
Comment #221
rwilson0429 CreditAttribution: rwilson0429 commentedPatch in #197 works great for me using Media 7.x-2.x-dev (June 1, 2016) along with the dev versions of:
file entity
multiform
Plupload
Media Bulk Upload submodule (enabled)
Comment #222
oranges13Can we make sure everyone is testing the right patch? Can you try the latest patch instead of one that's several comments back?
Comment #223
Proteo CreditAttribution: Proteo as a volunteer commented@oranges13 just to let you know, since I posted #220 I've updated several other sites (maybe a dozen) with the patch from #219, it worked without a hitch every time.
Comment #224
rwilson0429 CreditAttribution: rwilson0429 commentedI applied the patch in #219 against the latest dev (7.x-2.x-dev dated June 1, 2016) and it works fabulously great.
@oranges13, initially I didn't test Patch in #219 because it was "rolled against beta2". I'm using dev so I didn't think it would work against the dev version. However, based on your request, I did apply #219 against the latest dev and as I stated above it works great. Thanks for the awesome work on this issue. I hope it gets committed soon.
With Media patched with the patch in #219, I was able to upload multiple images in the same dialog and I was able to select multiple images from the media library simultaneously in the same dialog. This is a huge usability and functionality improvement for the media module.
Comment #225
AnybodyConfirming Patch from #219 works great. RTBC! Is there an active maintainer willing to apply this to the dev branch? I think this is a really really much deserved feature.
Thank you all so much!
Comment #226
mikeohara+∞
Good god, yes, please. I have been looking for a stable solution for months. This just made my month!
Comment #227
mukila CreditAttribution: mukila commentedThanks a lot oranges13. Confirming Patch from #219 works fine even with s3 integration.
Comment #228
mikeoharaI applied this patch (#219) and was able to get it to display the plupload form, and was able to upload assets.
What seems to be happening now, is it's showing the images uploaded in the node edit screen, however, when the note save happens, it only keeps the first image attached to the node from that upload set.
Any ideas what could cause this?
Comment #229
joseph.olstadPatch #197 works for us using D7 7.50 AND:
media version: 7.x-2.0-beta2
with these other patches for media
and file_entity
file_entity version: 7.x-2.0-beta3
with these patches for file_entity
as well as media_multiselect
git clone --branch 7.x-1.x https://git.drupal.org/sandbox/fangel/1652676.git media_multiselect
with this patch applied to media_multiselect
https://www.drupal.org/files/issues/media_multiselect-update_for_new_med...
.
Patch #197 does the trick for us, thanks! RTBC
Comment #230
mikeohara@joseph.olstad
What widget did you use for the node edit?
Comment #231
joseph.olstad@mikeohara , it was an image selector , select an image then save, then another browse button shows up, add as many as you like, these images are then used by lightbox2 using views to show a slideshow. not sure exactly what the widget was called, it's using media_multiselect.
Comment #232
oranges13@Joseph.olstad can you try patch from #219 as that's the latest? It was specifically rerolled to work with beta2.
Was there a conflict that prevented it from applying with the other patches?
media_multiselect shouldn't be needed, as that's the functionality this patch provides. The reason it wasn't working is because the patch from #197 breaks with media-7.x-beta2 but the patch from #219 restores that function. Can you try #219 WITHOUT media_multiselect?
Comment #233
oranges13@Mikeohara I just installed media-7.x-beta2 with this patch and no other patches (on a different site) and could not replicate your issue of only one file being saved on the node. I uploaded 5 images and all five were attached. It is a standard image field with "unlimited" cardinality in the field settings and colorbox for display.
Comment #234
mikeohara@oranges13
Yeah it's super strange. I can attach as many images as I want in edit. they get uploaded to the server, and show in the node/edit screen as present. After I hit save Only the first one remains attached to the node. They are all still in the system but not on the node. I've never seen anything like it.
Comment #235
oranges13@mikeohara I can't replicate that with a fresh install and only this patch. However, I've had really wonky behavior from media in general when upgrading in place with patches and repatching. So it may be that.
If you can, I would put your site in maintenance mode, make a back up of your current media directory and just reinstall and repatch using the most up to date versions of everything.
Comment #236
mikeoharaI've done so many times. We use an automated deployment system and locally I've triggered from-scratch builds on several occasions and the issue has never improved.
Comment #237
joseph.olstadHi @oranges13 , I backed off #197 and applied #229 and using the same setup it worked. However I did not uninstall or disable media_multiselect because of some dependency to it elsewhere.
Created a photo gallery node (custom node) added several images, saved and published it and my slideshow comes out as expected. So patch #197 and #229 works for us.
Thanks.
Comment #238
Rob C CreditAttribution: Rob C commentedYou should switch out all media_multiselect widgets for normal media widgets. Then edit all your features/custom modules and remove the dependency to media_multiselect. I've deprecated media_multiselect years ago and have been using the patches from this issue after Matt added his first patch. Also: https://www.drupal.org/node/2216273#comment-9424841 https://www.drupal.org/node/2216273#comment-9643069 etc etc. This patch should not be used with media_multiselect and media_multiselect will prolly not be updated, so reviewing patches for it has no use and only pollutes the issue queues. I didn't need to reinstall anything. Just added the patch from this issue, switch the field widgets back to media widgets, save that in features. Drop the dependency from your .info files. Commit everything. Revert features during release, uninstall the module and a cache clear and your set. And in the followup release drop the media_multiselect module itself.
Comment #239
chandu7929 CreditAttribution: chandu7929 commentedI can confirm the patch from #136 and #106 works absolutely great.
Using below mentioned modules.
- Media 7.x-2.0-alpha4
=> Bulk Upload sub enabled
- File Entity 7.x-2.0-beta1
- Plupload 7.x-1.7 -- and (Plupload library 1.5.8)
- Multiform 7.x-1.1
Comment #240
oranges13@chandu7929 can you please test the latest patches so we can get this approved instead of going back and forth between patch versions? The patch you should try is from #219. If you have problems with that patch, please let us know so we can fix it.
I'm removing all the other files to prevent this in the future. Please test the latest patch.
Comment #241
Rob C CreditAttribution: Rob C commentedComment #242
johnennew CreditAttribution: johnennew at Deeson commentedThe patch in #219 works pretty good but does have the following problem:
After uploading 1 or more files through the media browser (via plupload) the second screen is not shown, the one where the user is asked for the fields information. You have to click edit next to the uploaded files. Without the patch, the field edit screen appears as soon as the file is uploaded.
Comment #243
oranges13@ceng If you upload the files using the Content -> Files -> Add File interface, it will give you the opportunity to add the metadata for each file enmasse. I am pretty sure that the media field is what is skipping the metadata page and that it's always done so when the multiupload function was working.
Either you are able to upload multiple files at once from a field, or you have to pick and upload them individually. This patch just fixes the broken multi-upload feature. And unfortunately I didn't write it, I just made sure it merged with the most recent dev branch so I don't know.
*Technically* that would be a new issue, once this one is merged (if this one gets merged).
Comment #244
chandu7929 CreditAttribution: chandu7929 commented@oranges13,
I have used the patch #219 with current environment that i have mentioned in #239.
Our QA team has verified the changes and it is working fine.
Thanks.
Comment #245
joseph.olstadHi Rob C, thanks for the detailed steps in #238 , its on my TODO list....
@oranges13 , FYI patch 197 and 219 are functionally identical. Its working for us despite having not yet followed the steps in #238.
We're still using the aforementioned patch. No issues to report.
Comment #246
siramsay CreditAttribution: siramsay commentedtested patch #219 with 7.x-2.0-beta2 and works as other patches have in past
other modules/libraries used
file_entity: 7.x-2.0-beta3+3-dev (2016-Jun-22)
multiform: 7.x-1.1
plupload: 7.x-1.7 and version 1.5.8 of library
Comment #247
siramsay CreditAttribution: siramsay commented@ceng @oranges13
if you don't remove line ~119 in media.js, see below for code , then the media browser remains open and you get a message saying new alias' have been created. Does someone more familiar with the code base know how we could added the metadata page here from the Content -> Files -> Add File interface?
will look myself when I can find time but would be good to keep the modal dialog as in away it isn't really a new issue as it was there before and now it is removed for obvious reasons.
Thanks for the multi select though as this feature is awesome.
these lines
Comment #248
oranges13@size I think the question that needs to be answered is has media plus multi upload (and this patch in previous forms) ever shown the metadata?
I think the only time it showed before was with the default functionality of single selection.
Comment #249
siramsay CreditAttribution: siramsay commented@oranges I honestly think that the multi-select functionality is awesome and in having to make the choice over the metadata page I am choosing this. Be good to have this in the dev version at least. I just thought someone more familiar with the code base maybe able to add the metadata page back as it is present as you say in the file interface.
Comment #250
Steve Polito Design CreditAttribution: Steve Polito Design commentedApplied patch from #219 and am having good luck so far. Also works well with Plupload. Below the modules I have installed.
Comment #251
joseph.olstadI've pinged the active maintainer slashrsm asking him to commit this.
Comment #252
brockfanning CreditAttribution: brockfanning commentedDoes anyone know if the file edit modal is supposed to popup after an upload, with this patch? For me, it's not. But, that may be due to one of the many other Media-related patches I have applied... If the file edit modal is popping up after an upload for anyone using this patch, I would like to get some details on your recipe.
EDIT: Just read #247 - I take it that what I'm calling the "file edit modal" is what @size you are calling the "metadata"? I will look into that bit of code.
Comment #253
siramsay CreditAttribution: siramsay commented@brockfanning yes this is what I called the metadata page and later metadata screen (#249) I guess I should keep my name consistent, and metadata modal (dialog) might be the best name for this.
I edited my comment at #247 to read modal dialog instead of just dialog as it said before.
Comment #254
oranges13To my knowledge, the combination of these modules has never shown the metadata screen after bulk upload on node forms.
Comment #255
dddbbb CreditAttribution: dddbbb as a volunteer commentedAlso having success with the patch in #219 - also with Plupload integration. Top work! +1 RTBC
Comment #256
brockfanning CreditAttribution: brockfanning commentedSo as not to hold up #219, I've started a separate issue for bulk metdata editing, and posted a patch for review there: #2818683: Bulk field editing after bulk uploading
Comment #257
joseph.olstadI've reached out to the maintainers however they are not willing to step in or are too busy maintaining other modules, so the next step is to make a request maintainer access through the next channel which is through a support request on drupal.org
.
Comment #258
legolasboHave you tried asking the maintainers to grant maintainership of the module? No need to go over their head of they are willing to accept help from the community.
Comment #259
dtarc CreditAttribution: dtarc as a volunteer and at Affinity Bridge commentedI think the problem here is that nobody's been able to provide passing test coverage.
Comment #260
joseph.olstad@dtarc , the problem is there's not enough active 7.x maintainers for media because the 7.x-2.x branch tests are failing so there's no point writing test coverage for this patch until the branch is able to pass testing.
Over a month ago I created a ticket
#2792499: Media testbot fix urgent on 7.x-2.x branch
however no one paid any attention to it.
So , after contacting the maintainers but they are too busy on other projects I've requested co-maintainer access to be able to commit this patch. I don't promise any miracles but at least I'll be able to resolve a few pressing issues like
#2792499: Media testbot fix urgent on 7.x-2.x branch
and also this issue.
One of the maintainers is maintaining about 30 projects so he has no time.
Comment #262
joseph.olstadfixed in 7.x-2.x dev branch
Comment #263
Proteo CreditAttribution: Proteo as a volunteer commentedWow, finally!! Thank you all!
Comment #264
mglamanSour grapes incoming:
Way back in #77 I spent nearly a week straight working this out and then in #106 to get further passing tests. And not just me, others helped test and re-roll. And there is only one person mentioned in the commit credit.
Luckily the issue credits on the issue are logged, at least. I just think this is a huge milestone and it'd of been nice to see the epic commit message from all the collaborators.
Comment #265
joseph.olstadSorry mglaman, totally unintentional, I used this commit message:
git commit -m 'Issue #951004 by mglaman, jsst, oranges13, dtarc, Dave Reid, uniquename, thursday_bw, size, hk0023, akalam, msound: Allow selecting of multiple media items for a multi value media field in the same dialog' --author="oranges13 "
This is what the issue defaulted. Last uploaded patch was by oranges13.
Can fix the message with -amend flag.
Maybe later, right now priority is getting a 2.0 release done. 2.x-beta3 was released today