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.

Files: 
CommentFileSizeAuthor
#99 expose-filetypes-wysiwyg-1016376-99.patch4.18 KBParisLiakos
PASSED: [[SimpleTest]]: [MySQL] 11 pass(es).
[ View ]
#91 expose-filetypes-wysiwyg-1016376-91.patch4.18 KBParisLiakos
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch expose-filetypes-wysiwyg-1016376-91.patch. Unable to apply patch. See the log in the details link for more information.
[ View ]
#86 expose-filetypes-wysiwyg-1016376-84.patch4.06 KBParisLiakos
FAILED: [[SimpleTest]]: [MySQL] Failed to run tests: run-tests.sh reported no tests were found. See review log for details..
[ View ]
#82 expose-filetypes-wysiwyg-1016376-82.patch876 bytesmrfelton
PASSED: [[SimpleTest]]: [MySQL] 0 pass(es).
[ View ]
#77 expose-filetypes-wysiwyg-1016376-77.patch865 bytesaaron
PASSED: [[SimpleTest]]: [MySQL] 0 pass(es).
[ View ]
#74 expose-filetypes-wysiwyg-1016376-74.patch1.22 KBlsolesen
PASSED: [[SimpleTest]]: [MySQL] 0 pass(es).
[ View ]
#72 expose-filetypes-wysiwyg-1016376-72.patch1.3 KBlsolesen
PASSED: [[SimpleTest]]: [MySQL] 0 pass(es).
[ View ]
#70 expose-filetypes-wysiwyg-1016376-70.patch768 byteslsolesen
PASSED: [[SimpleTest]]: [MySQL] 0 pass(es).
[ View ]
#68 expose-filetypes-wysiwyg-1016376-68.patch855 byteslsolesen
PASSED: [[SimpleTest]]: [MySQL] 0 pass(es).
[ View ]
#64 media.patch997 bytesarthurf
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch media.patch. Unable to apply patch. See the log in the details link for more information.
[ View ]
#58 expose-file-types-to-wysiwyg-1016376-58.patch1.04 KBaaron
PASSED: [[SimpleTest]]: [MySQL] 0 pass(es).
[ View ]
#54 expose-file-types-to-wysiwyg-1016376-54.patch1002 bytesaaron
PASSED: [[SimpleTest]]: [MySQL] 26 pass(es).
[ View ]
#52 1016376-52.patch2.02 KBeffulgentsia
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch 1016376-52.patch. This may be a -p0 (old style) patch, which is no longer supported by the testbots.
[ View ]
#43 0001-Issue-1016376-Expose-the-media-types-allowed-for-WYS.patch10.15 KBjames.elliott
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch 0001-Issue-1016376-Expose-the-media-types-allowed-for-WYS.patch. This may be a -p0 (old style) patch, which is no longer supported by the testbots.
[ View ]
#28 1016376-add-audio-as-allowed-wysiwyg-type.patch1.48 KBDave Reid
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch 1016376-add-audio-as-allowed-wysiwyg-type.patch. This may be a -p0 (old style) patch, which is no longer supported by the testbots.
[ View ]

Comments

please fixx! id like to upload audio aswell :)

Yes. +1 for that. Just tried it on Drupal Gardens and doesn't really work. Also needs a widget to display it properly.

The MediaElement module is supposed to work with audio.

+1. It should be possible to embed any media asset into a node, not only images and video (or audio).

+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.

@ 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..

The 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.

+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.

+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.

subscribing : 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 !

subscribe

same need here

Where would this change need to take place in media or styles or both?

Actually 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!

variable_set('media__wysiwyg_allowed_types', 'a:3:{i:0;s:5:"image";i:1;s:5:"video";i:2;s:7:"default";}');

Assigned:Unassigned» kaluchkin
Priority:Normal» Critical

where 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";}');

@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.

subscribe

+1

Subscribing.

Assigned:kaluchkin» Unassigned
Priority:Critical» Normal

Actually, after patching the latest D7 version from today it seems to be working far better.

subscribing

Subscribing.

+1 A way to upload and link to a PDF from the wysiwyg.

#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.)

I'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.

Status:Active» Needs review
StatusFileSize
new1.48 KB
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch 1016376-add-audio-as-allowed-wysiwyg-type.patch. This may be a -p0 (old style) patch, which is no longer supported by the testbots.
[ View ]

As a first step we should allow 'audio' as a type.

Version:7.x-1.x-dev» 7.x-2.x-dev
Status:Needs review» Reviewed & tested by the community

@Dave Reid -- this patch looks good. As a temporary measure, RTBC!

Title:Allow media types other than image and video into WYSIWYGExpose the media types allowed for WYSIWYG variable in the UI
Status:Reviewed & tested by the community» Active

Committed #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.

The next question I see is where this UI should be. Seems correct to have it per field not per instance. Maybe also global?

Sure, but WYSIWYG != fields. WYSIWYG configs are tied to input formats, not specific fields. This would likely have to be a global configuration.

What 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.

How 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...

@muschpusch: As far as I know there's no type other - I know only the type default under which PDF's should be handled.

@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.

Priority:Normal» Critical

I would like to see us solve this issue during the upcoming sprint or at least make some major headway with it.

I would like to see us solve this issue during the upcoming sprint or at least make some major headway with it.

subscrb

subscribe

subscribing

Sub,

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)

StatusFileSize
new10.15 KB
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch 0001-Issue-1016376-Expose-the-media-types-allowed-for-WYS.patch. This may be a -p0 (old style) patch, which is no longer supported by the testbots.
[ View ]

Attached is a stopgap solution to expose this global setting in the UI.

Subscribing.

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.

subscribe

@ 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...

Thanks ZuluWarrior. I found installing imce and imce_wyswig did the trick. I'll give your method a whirl too...

Interesting 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!

@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

+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. :-(

@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.)

Status:Active» Needs review
StatusFileSize
new2.02 KB
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch 1016376-52.patch. This may be a -p0 (old style) patch, which is no longer supported by the testbots.
[ View ]

Patch in #43 has some extraneous and irrelevant hunks. Here's a cleaned up version.

Status:Needs review» Needs work

The last submitted patch, 1016376-52.patch, failed testing.

Status:Needs work» Needs review
StatusFileSize
new1002 bytes
PASSED: [[SimpleTest]]: [MySQL] 26 pass(es).
[ View ]

Here'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.

Status:Needs review» Needs work

For 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.

#54 doesn't fix the issue.

#52 doesn't apply anymore. Would you please recreate this patch?

Status:Needs work» Needs review

@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.

StatusFileSize
new1.04 KB
PASSED: [[SimpleTest]]: [MySQL] 0 pass(es).
[ View ]

This one uses the correct file_info_file_types().

Took 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...

Status:Needs review» Needs work

Just noticed I forgot to change status. Bummer.

Component:Code» WYSIWYG integration

We should also be using file_type_get_names() rather than file_info_file_types().

Priority:Critical» Normal

Downgrading this back to normal, but this is still on the want-soon wishlist.

Priority:Normal» Critical
StatusFileSize
new997 bytes
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch media.patch. Unable to apply patch. See the log in the details link for more information.
[ View ]

Modified 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.

Priority:Critical» Major
Issue tags:+sprint, +Media Initiative

The 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.

Ok this needs to be rolled after #1434118: Make a Separate Config for WYSIWYG's Media Browser has landed.

Status:Needs work» Needs review
StatusFileSize
new855 bytes
PASSED: [[SimpleTest]]: [MySQL] 0 pass(es).
[ View ]

Rerolled patch.

Status:Needs review» Needs work

+++ b/includes/media.admin.inc
@@ -311,6 +311,16 @@ function media_admin_config_browser($form, &$form_state) {
+    ¶

Unnecessary spacing

+++ b/includes/media.admin.inc
@@ -311,6 +311,16 @@ function media_admin_config_browser($form, &$form_state) {
+    foreach (file_type_get_names() as $type => $name) {
+      $options[$type] = $name;
+    }
+    $form[media_variable_name('wysiwyg_allowed_types')] = array(
+      '#type' => 'checkboxes',
+      '#title' => t('Allowed types in WYSIWYG'),
+      '#options' => $options,
+      '#default_value' => media_variable_get('wysiwyg_allowed_types'),
+    );

Can't this just be

$form[media_variable_name('wysiwyg_allowed_types')] = array(
  '#type' => 'checkboxes',
  '#title' => t('Allowed types in WYSIWYG'),
  '#options' => file_type_get_names(),
  '#default_value' => media_variable_get('wysiwyg_allowed_types'),
);

Status:Needs work» Needs review
StatusFileSize
new768 bytes
PASSED: [[SimpleTest]]: [MySQL] 0 pass(es).
[ View ]

Status:Needs review» Needs work

Seems that there should be added and array filter - see #1673070: Redundant 0 in error message when uploading to WYSIWYG

Status:Needs work» Needs review
StatusFileSize
new1.3 KB
PASSED: [[SimpleTest]]: [MySQL] 0 pass(es).
[ View ]

Status:Needs review» Needs work

This is using the same foreach as before and has additional spacing. I would fix that up.

Status:Needs work» Needs review
StatusFileSize
new1.22 KB
PASSED: [[SimpleTest]]: [MySQL] 0 pass(es).
[ View ]

Rerolled.

I would rather we use this hack on the admin_form rather than filter it in submit:

<?php
$form
['array_filter'] = array('#type' => 'value', '#value' => TRUE);
?>

Dave, I don't understand that hack. What will it do?

StatusFileSize
new865 bytes
PASSED: [[SimpleTest]]: [MySQL] 0 pass(es).
[ View ]

no matter. The hack certainly works. Here is a reroll, with Dave's suggestion.

Status:Needs review» Needs work

This 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.

Status:Needs work» Needs review

Ok, 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.

Shouldn'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?

I 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

StatusFileSize
new876 bytes
PASSED: [[SimpleTest]]: [MySQL] 0 pass(es).
[ View ]

The 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.

Status:Needs review» Needs work

per #80

I am able to embed file types that are not checked in the settings form

Status:Needs work» Needs review

Ok 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

Ok 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

StatusFileSize
new4.06 KB
FAILED: [[SimpleTest]]: [MySQL] Failed to run tests: run-tests.sh reported no tests were found. See review log for details..
[ View ]

And...forgot the patch -.-

Status:Needs review» Needs work
Issue tags:-sprint, -Media Initiative

The last submitted patch, expose-filetypes-wysiwyg-1016376-84.patch, failed testing.

Status:Needs work» Needs review

Status:Needs review» Needs work
Issue tags:+sprint, +Media Initiative

The last submitted patch, expose-filetypes-wysiwyg-1016376-84.patch, failed testing.

Whatever, 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 -.-

Status:Needs work» Needs review
StatusFileSize
new4.18 KB
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch expose-filetypes-wysiwyg-1016376-91.patch. Unable to apply patch. See the log in the details link for more information.
[ View ]

Removed misleading comment

Status:Needs review» Needs work

The last submitted patch, expose-filetypes-wysiwyg-1016376-91.patch, failed testing.

Status:Needs work» Needs review

@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?

Status:Needs review» Reviewed & tested by the community

double-posted... dumb internets. sorry.

My patch provides the admin configuration screen for the allowed file types and solves this:

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?

For this:

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?

see issue and patches here #1451316: Clean up wysiwyg-media.js

thanks for rtbcing this!

Assigned:Unassigned» Dave Reid

I would like Dave to review #91 before committing this

StatusFileSize
new4.18 KB
PASSED: [[SimpleTest]]: [MySQL] 11 pass(es).
[ View ]

rerolled patch after latest commits

Assigned:Dave Reid» Unassigned
Status:Reviewed & tested by the community» Fixed

OK 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:)

Status:Fixed» Closed (fixed)
Issue tags:-sprint, -Media Initiative

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