Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
All media types can be uploaded to a media field but only image and video are allowed in WYSIWYG. There are obstacles in determining how to handle the display of non-visual file types in the WYSIWYG editor.
Comment | File | Size | Author |
---|---|---|---|
#99 | expose-filetypes-wysiwyg-1016376-99.patch | 4.18 KB | ParisLiakos |
#91 | expose-filetypes-wysiwyg-1016376-91.patch | 4.18 KB | ParisLiakos |
#86 | expose-filetypes-wysiwyg-1016376-84.patch | 4.06 KB | ParisLiakos |
#82 | expose-filetypes-wysiwyg-1016376-82.patch | 876 bytes | mrfelton |
#77 | expose-filetypes-wysiwyg-1016376-77.patch | 865 bytes | aaron |
Comments
Comment #1
yochee CreditAttribution: yochee commentedplease fixx! id like to upload audio aswell :)
Comment #2
CinemaSaville CreditAttribution: CinemaSaville commentedYes. +1 for that. Just tried it on Drupal Gardens and doesn't really work. Also needs a widget to display it properly.
Comment #3
Scott J CreditAttribution: Scott J commentedThe MediaElement module is supposed to work with audio.
Comment #4
lifepillar CreditAttribution: lifepillar commented+1. It should be possible to embed any media asset into a node, not only images and video (or audio).
Comment #5
effulgentsia CreditAttribution: effulgentsia commented+1 from me too. I might be wrong, but my hunch is that none of the project maintainers will have time to implement this before DrupalCon Chicago, but if others submit patches, we'll try to make the time to review. At the conference, we plan on having a BoF to discuss roadmap and solicit more community help to keep advancing this module.
Comment #6
yochee CreditAttribution: yochee commented@ Scott: Yes it might be supposed to be able to do this, but actually it isnt.
without patching its says you are allowed to upload txt, pdf, mp3 etc., but after trying to upload it just gives me an error message that uploading video and txt is allowed only.
i patched it, now uploading mp3-files isnt allowed anymore. so still.. it doesnt work with audio. with txt and video it works great. seems just to be a files-permissions thingy..
Comment #7
JacobSingh CreditAttribution: JacobSingh commentedThe challenge is the WYSIWYG integration. The code we have there now is not fantastic, but the way it works is that we insert an image which acts as a placeholder for what will really be rendered there. For images and videos we have thumbs. I guess we just need to implement something similar for audio, or do something fancy where we use GD to render the name of the song and artist on an image which *looks* like an player (or flash equivalent).
It's a little sticky to do... there is another issue somewhere about allowing any type of file and showing a link to the file if we don't have a nice formatter. This has a similar challenge and would be nice to nail first.
Comment #8
likewhoa CreditAttribution: likewhoa commented+1 for all media files type to be supported in wysiwyg editor instead of just video and image file types. This is what is missing in this module and there doesn't seem to be anything else in D7 at least that can automatically turn audio into playable media besides the cck audio field but that doesn't work in D7 as of now.
Looking forward to progress, for now i'll try using MediaElement as @Scott J suggested.
Comment #9
jerodfritz CreditAttribution: jerodfritz commented+1 A way to upload and link to a PDF from the wysiwyg would be great. Now we have to add another field to the content type which I'd like to remove.
Comment #10
iko CreditAttribution: iko commentedsubscribing : same need : inserting PDF docs requires now a distinct field, which means the impossibility to re-use a previously uploaded document in another node.
thanks !
Comment #11
cartagena CreditAttribution: cartagena commentedsubscribe
Comment #12
Jose_ibi CreditAttribution: Jose_ibi commentedsame need here
Comment #13
Jackinloadup CreditAttribution: Jackinloadup commentedWhere would this change need to take place in media or styles or both?
Comment #14
das-peter CreditAttribution: das-peter commentedActually you're able to enable other media types for wysiwyg selection.
But I'm not sure how well the support for the different display formatters is.
At least the link formatter seems to work :)
To enable the other types you have to set the variable
media__wysiwyg_allowed_types
Following snipped should work - but be careful!
Comment #15
kaluchkin CreditAttribution: kaluchkin commentedwhere to put this text line?
i mean this >> variable_set('media__wysiwyg_allowed_types', 'a:3:{i:0;s:5:"image";i:1;s:5:"video";i:2;s:7:"default";}');
Comment #16
das-peter CreditAttribution: das-peter commented@kaluchkin: Well, I suggest to run it as php code with the devel module. It's not intended to have this snipped somewhere in the code.
Comment #17
mightyiam CreditAttribution: mightyiam commentedsubscribe
Comment #18
TripX CreditAttribution: TripX commented+1
Comment #19
Taxoman CreditAttribution: Taxoman commentedSubscribing.
Comment #20
ParisLiakos CreditAttribution: ParisLiakos commentedComment #21
3rdLOF CreditAttribution: 3rdLOF commentedActually, after patching the latest D7 version from today it seems to be working far better.
Comment #22
sunThis is kind of a duplicate of #1019988: Call for contributors: Joint community effort on embedding/inlining content and media
Comment #23
idflood CreditAttribution: idflood commentedsubscribing
Comment #24
CarelessChaser CreditAttribution: CarelessChaser commentedSubscribing.
Comment #25
Anonymous (not verified) CreditAttribution: Anonymous commented+1 A way to upload and link to a PDF from the wysiwyg.
Comment #26
Taxoman CreditAttribution: Taxoman commented#25: what exactly to you mean?
Two options comes to my mind: - linking to a printable PDF version of the node (ref. "Printer, e-mail and PDF versions": https://drupal.org/project/print )
and just linking to an existing uploaded PDF document (just a link to an attachment, which is already easy to do with fields in core)
Something else?
(There is also an interesting module called iPaper - https://drupal.org/project/ipaper , not sure if that one can be of relevance here.)
Comment #27
becw CreditAttribution: becw commentedI'd like the default value here to change, and/or allow configuration somewhere in the WYSIWYG section.
In my testing, I can manually set the
'media__wysiwyg_allowed_types'
variable with drush, and then inserting audio works as expected: I can select an audio file from the media browser, choose a format, and then it appears in the WYSIWYG text area as an audio icon. When I save the content, the audio is rendered in whatever format I selected (just the "Generic File" formatter for now, since mediaelement isn't working for me with the current media 1.x or 2.x development).To set the variable with drush, I use:
drush php-eval 'variable_set("media__wysiwyg_allowed_types", array("image", "audio", "video"));'
After inserting the audio in the WYSIWYG, I see:
https://img.skitch.com/20110810-cyh3ywc5rn1cbse23qeiixa29f.png
And after saving the content, I see:
https://img.skitch.com/20110810-ciq3x7bua6ppimmtmi3bd9ynap.png
I think that what needs to be done is expose this configuration somewhere. It could be a universal setting, or with more work it could be made a per-wysiwyg setting. There are several other hidden settings in the media.variables.inc file, too.
Comment #28
Dave ReidAs a first step we should allow 'audio' as a type.
Comment #29
becw CreditAttribution: becw commented@Dave Reid -- this patch looks good. As a temporary measure, RTBC!
Comment #30
Dave ReidCommitted #28 to 7.x-2.x and 7.x-1.x.
http://drupalcode.org/project/media.git/commit/c1146d5
http://drupalcode.org/project/media.git/commit/fe0e354
We should investigate exposing this variable in the UI.
Comment #31
Jackinloadup CreditAttribution: Jackinloadup commentedThe next question I see is where this UI should be. Seems correct to have it per field not per instance. Maybe also global?
Comment #32
Dave ReidSure, but WYSIWYG != fields. WYSIWYG configs are tied to input formats, not specific fields. This would likely have to be a global configuration.
Comment #33
das-peter CreditAttribution: das-peter commentedWhat about different wysiwyg buttons for each media type? That way it would also be permission sensitive (Textformats)
The wysiwyg buttons define which type to handle but the code in the background could stay nearly the same as now.
Comment #34
muschpusch CreditAttribution: muschpusch commentedHow can i add pdf's?
I tried: drush php-eval 'variable_set("media__wysiwyg_allowed_types", array("image", "audio", "video", "other"));'
But it's still not possible to add them...
Comment #35
das-peter CreditAttribution: das-peter commented@muschpusch: As far as I know there's no type
other
- I know only the typedefault
under which PDF's should be handled.Comment #36
muschpusch CreditAttribution: muschpusch commented@das-Peter: thanks. But it isn't working. I can upload the document but can't hit the submit button. I'm still using the 7.x-1.x branch but also tested it with the 7.x-2.x branch.
Comment #37
robeano CreditAttribution: robeano commentedI would like to see us solve this issue during the upcoming sprint or at least make some major headway with it.
Comment #38
robeano CreditAttribution: robeano commentedI would like to see us solve this issue during the upcoming sprint or at least make some major headway with it.
Comment #39
CrashNet CreditAttribution: CrashNet commentedsubscrb
Comment #40
bryancasler CreditAttribution: bryancasler commentedsubscribe
Comment #41
ddanier CreditAttribution: ddanier commentedsubscribing
Comment #42
ZuluWarrior CreditAttribution: ZuluWarrior commentedSub,
Any progress? I've got my use case to like 90% but the final key step, being able to insert media (video, audio or image) via the media button on my wysiwyg eludes me!
It so almost works, media browsers there, doesn't show audio (will be patching as per above), but once my piece of media is selected I get the format choice (Large, Small Ect) but can not submit this form :(
Ammendum: Clicking submit causes a javascript error, 'imgElement is undefined' originating from wysiwyg-media line 191...
2nd Ammendum: Some issues fixed in latest dev of media, javascript errors caused by the file's formatter somewhere in the dialog code. (Seems to want to load the selected formatter, however IMHO a placeholder should be loaded and replaced inthe wysiwyg and node output shouldhonour the formatter)
Comment #43
james.elliott CreditAttribution: james.elliott commentedAttached is a stopgap solution to expose this global setting in the UI.
Comment #44
codesmithSubscribing.
I'm here trying to solve the problem of how to use WYSIWYG/CKEditor to upload and embed PDF files -- ie. upload a PDF file and a PDF icon is inserted into the HTML which is linked to the PDF file. I tried suggestions here with no luck and just switched to 7.x-2.x-dev. Have the same javascript errors as #42 in wysiwig-media.js.
I checked /admin/content/media and the PDF file gets uploaded - I see the correct file size, a link and a little PDF icon in the Media. I also see the file in /sites/default/files/. Clicking on the link from the Media page to view it though results in a themed page with no content.
So it looks like being able to upload non-image files using this method isn't there yet. Can anyone recommend an alternative to allow PDF uploads using the WYSIWY/CKeditor combo in Drupal 7? TIA.
Comment #45
bryancasler CreditAttribution: bryancasler commentedsubscribe
Comment #46
ZuluWarrior CreditAttribution: ZuluWarrior commented@ codesmith,
I found that the latest dev of media, without any formatters or players installed, seems to work in serving files as links (with a little icon).
I got files as links working by going to media control panel, ensure you know which media type the pdf is being uploaded under (as I think the default list changed between stable and dev), and ensure under file display each preset is set to generic file.
This worked for me however as soon as I added mediaelement module the javascript error starts, also worth noting that at the time I was not using media styles module...
Comment #47
codesmithThanks ZuluWarrior. I found installing imce and imce_wyswig did the trick. I'll give your method a whirl too...
Comment #48
codesmithInteresting got somewhere with ZuluWarrior's method too. I do get a little PDF icon now however it lists the name of the PDF next to the icon and the name is linked (not the icon). Didn't see a way to change the text of the link. Closer!
Comment #49
ZuluWarrior CreditAttribution: ZuluWarrior commented@codesmith
I believe you can override the generic view of a file with a theme override...
Not sure, have not had a chance to try, but I believe 'Generic File' hands the rendering off to the basic file theme functions :
theme_file_icon
theme_file_link
Comment #50
jrabeemer CreditAttribution: jrabeemer commented+1
This is a big feature omission. The WYSIWYG button needs to allow for other media types. I have a client expecting to be able to embed uploaded documents and we can't do that at the moment. :-(
Comment #51
codesmith@momendo - my workaround was to install "IMCE" and then the "IMCE Wysiwyg API bridge". Enable "IMCE" in the WYSIWYG toolbar settings and then optionally disable the "Media browser" button. Uploads of any file type work fine. (Note used CK Editor library for WWYSIWYG.)
Comment #52
effulgentsia CreditAttribution: effulgentsia commentedPatch in #43 has some extraneous and irrelevant hunks. Here's a cleaned up version.
Comment #54
aaron CreditAttribution: aaron commentedHere's a simpler version, that also puts it on the existing Media Browser Settings page at admin/config/media/browser. Sorry, I did the work before I remembered about this issue.
Comment #55
Lukas von BlarerFor me this doesn't fix the issue. I can see the setting for the file types but I am still not able to insert a PDF.
Comment #56
Lukas von Blarer#54 doesn't fix the issue.
#52 doesn't apply anymore. Would you please recreate this patch?
Comment #57
aaron CreditAttribution: aaron commented@Lukas von Blarer: The 2 patches are identical in function. Currently, you would need to select the 'application' file type to insert PDF files. Please do not hijack the issue. Thanks.
Comment #58
aaron CreditAttribution: aaron commentedThis one uses the correct file_info_file_types().
Comment #59
tsvenson CreditAttribution: tsvenson commentedTook a quick look at this patch. It lets me configure the types to embed, however when I then use the browser plugin its only for the old Library tab files get filtered. The new Views library shows everything and also let me pick and embed everything.
Caches flushed...
Comment #60
tsvenson CreditAttribution: tsvenson commentedJust noticed I forgot to change status. Bummer.
Comment #61
Dave ReidComment #62
Dave ReidWe should also be using file_type_get_names() rather than file_info_file_types().
Comment #63
Dave ReidDowngrading this back to normal, but this is still on the want-soon wishlist.
Comment #64
arthurf CreditAttribution: arthurf commentedModified Aaron's patch per #62 There are some other issues that I had when I was trying to save my flickr url but these seem more related to 7.x-2.x than this patch.
Comment #65
Dave ReidComment #66
John Pitcairn CreditAttribution: John Pitcairn commentedThe patch at #58 or #64 is incompatible with the patch at #1434118: Make a Separate Config for WYSIWYG's Media Browser - both modify the same code.
And the patch at #58 or #62 does not work against latest dev for me anyway - the settings are present and can be saved, but available file types are not limited in the wysiwyg media browser library.
Comment #67
Dave ReidOk this needs to be rolled after #1434118: Make a Separate Config for WYSIWYG's Media Browser has landed.
Comment #68
lsolesen CreditAttribution: lsolesen commentedRerolled patch.
Comment #69
redndahead CreditAttribution: redndahead commentedUnnecessary spacing
Can't this just be
Comment #70
lsolesen CreditAttribution: lsolesen commentedComment #71
lsolesen CreditAttribution: lsolesen commentedSeems that there should be added and array filter - see #1673070: Redundant 0 in error message when uploading to WYSIWYG
Comment #72
lsolesen CreditAttribution: lsolesen commentedAdded an array filter to avoid #1673070: Redundant 0 in error message when uploading to WYSIWYG.
Comment #73
redndahead CreditAttribution: redndahead commentedThis is using the same foreach as before and has additional spacing. I would fix that up.
Comment #74
lsolesen CreditAttribution: lsolesen commentedRerolled.
Comment #75
Dave ReidI would rather we use this hack on the admin_form rather than filter it in submit:
Comment #76
aaron CreditAttribution: aaron commentedDave, I don't understand that hack. What will it do?
Comment #77
aaron CreditAttribution: aaron commentedno matter. The hack certainly works. Here is a reroll, with Dave's suggestion.
Comment #78
mrfelton CreditAttribution: mrfelton commentedThis seems to work for the most part, although I still can't properly insert a PDF into content. I can now see the PDF in the file browser, but the only view mode that it lets me select is the 'Preview' one, which just inserts a filetype icon. I have configured other View modes. For example, I have the Full view modes set up to use the Google Viewer file formatter. I can see the Full mode as an option in the modal dialog when inserting, but I can not press the submit button. The submit button only works for the Preview view mode.
Comment #79
mrfelton CreditAttribution: mrfelton commentedOk, my issue looks to be some js issue:
"Uncaught TypeError: Cannot read property 'attributes' of undefined " wysiwyg-media.js:195
I think unrelated to this patch, so setting back to needs review.
Comment #80
ParisLiakos CreditAttribution: ParisLiakos commentedShouldn't it be impossible to add lets say an mp3 in wysiwyg if you have not select audio in the form of this patch?
i use ckeditor + wysiwyg
Maybe wysiwyg media plugin should be using a different view that has a contextual filter for the types of files that should be displayed?
Comment #81
avolve CreditAttribution: avolve commentedI have be re-reading many of the posts in the issue queue for the media module, and think this, may the appropriate place for my Q.
From what I have read (and tested), uploading pdf (and other doc files) with the media browser, WYSIWYG and CKEditor for insertion of download links is not yet a workable option. (i.e. a large generic image for document files is displayed, and no download links)
For a site under development, I have reverted back to using a file field and insert module for attaching documents and inserting links to the files. This appears to be to current best-practice approach?
The issue I a struggling with, is that the media library lists document files even if these file types are not listed as 'allowed file extensions' in the configuration settings for the media browser (i.e. pdf, etc when only image files are listed as allowed). Can anyone offer a solution (or a least a workaround) for this?
thx
Comment #82
mrfelton CreditAttribution: mrfelton commentedThe settings should only be added to the config page when wysiwyg module is enabled. Attached patch resolves that by moving the settings into the wysiwyg fieldset, which has #access set on it.
Comment #83
ParisLiakos CreditAttribution: ParisLiakos commentedper #80
I am able to embed file types that are not checked in the settings form
Comment #84
ParisLiakos CreditAttribution: ParisLiakos commentedOk i think there was another issue for this #1293908: Respect file type restrictions in media browser library view
i ll check later with the latest dev version since the above commited
Comment #85
ParisLiakos CreditAttribution: ParisLiakos commentedOk i think this finally is..
It also filters field browsers.
So in video media fields you only get video, in image fields image and in wysiwyg whatever you specified in configuration form:D
It depends on the patch commited in #1293908: Respect file type restrictions in media browser library view so be sure you have this commit
Comment #86
ParisLiakos CreditAttribution: ParisLiakos commentedAnd...forgot the patch -.-
Comment #88
ParisLiakos CreditAttribution: ParisLiakos commented#86: expose-filetypes-wysiwyg-1016376-84.patch queued for re-testing.
Comment #90
ParisLiakos CreditAttribution: ParisLiakos commentedWhatever, this wont get green, seems something to do with this #1774482: Modules with no tests shouldn't actually fail
please review this someone, bot wont let needs review status there -.-
Comment #91
ParisLiakos CreditAttribution: ParisLiakos commentedRemoved misleading comment
Comment #93
ParisLiakos CreditAttribution: ParisLiakos commentedComment #94
jacobroufa CreditAttribution: jacobroufa commented@rootatwc seems your patch works - I have options now in my admin to select file types. Thanks for providing it and sorry it's not passing testing. :)
A couple issues still though:
- I had to use the patch at #1743040 to strip tags so I could select files in the media browser. This works now as expected.
- I'm still experiencing the issue that @avolve is having in 81, above, where I either get the large generic document image... OR just the application image icon based on file type (pdf or doc)... But no link to the file. Even if I try what is suggested further above and enable IMCE/IMCE_WYSIWYG. It seems whatever I try, I can't get past this limitation in display. All I really want is to display a link to the file for download; application image icon isn't even a requirement for me.
Any suggestions?
Comment #95
jacobroufa CreditAttribution: jacobroufa commenteddouble-posted... dumb internets. sorry.
Comment #96
ParisLiakos CreditAttribution: ParisLiakos commentedMy patch provides the admin configuration screen for the allowed file types and solves this:
For this:
see issue and patches here #1451316: Clean up wysiwyg-media.js
thanks for rtbcing this!
Comment #97
ParisLiakos CreditAttribution: ParisLiakos commented#91: expose-filetypes-wysiwyg-1016376-91.patch queued for re-testing.
Comment #98
ParisLiakos CreditAttribution: ParisLiakos commentedI would like Dave to review #91 before committing this
Comment #99
ParisLiakos CreditAttribution: ParisLiakos commentedrerolled patch after latest commits
Comment #100
ParisLiakos CreditAttribution: ParisLiakos commentedOK i extensively tested it, so i took the liberty to commit this, splitting in two commits.
First part add the form, essentially patch at #82
http://drupalcode.org/project/media.git/commit/616a307
Second patch adds the part that makes the media browser in wysiwyg actually respect those settings
http://drupalcode.org/project/media.git/commit/2f5fe4a
thanks everyone:)