Support from Acquia helps fund testing for Drupal Acquia logo

Comments

yochee’s picture

please fixx! id like to upload audio aswell :)

CinemaSaville’s picture

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

Scott J’s picture

The MediaElement module is supposed to work with audio.

lifepillar’s picture

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

effulgentsia’s picture

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

yochee’s picture

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

JacobSingh’s picture

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.

likewhoa’s picture

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

jerodfritz’s picture

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

iko’s picture

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 !

cartagena’s picture

subscribe

Jose_ibi’s picture

same need here

Jackinloadup’s picture

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

das-peter’s picture

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";}');
kaluchkin’s picture

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

das-peter’s picture

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

mightyiam’s picture

subscribe

TripX’s picture

+1

Taxoman’s picture

Subscribing.

ParisLiakos’s picture

Assigned: kaluchkin » Unassigned
Priority: Critical » Normal
3rdLOF’s picture

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

sun’s picture

idflood’s picture

subscribing

CarelessChaser’s picture

Subscribing.

Anonymous’s picture

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

Taxoman’s picture

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

becw’s picture

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.

Dave Reid’s picture

Status: Active » Needs review
FileSize
1.48 KB

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

becw’s picture

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!

Dave Reid’s picture

Title: Allow media types other than image and video into WYSIWYG » Expose 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.

Jackinloadup’s picture

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

Dave Reid’s picture

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

das-peter’s picture

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.

muschpusch’s picture

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

das-peter’s picture

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

muschpusch’s picture

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

robeano’s picture

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.

robeano’s picture

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

CrashNet’s picture

subscrb

bryancasler’s picture

subscribe

ddanier’s picture

subscribing

ZuluWarrior’s picture

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)

james.elliott’s picture

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

codesmith’s picture

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.

bryancasler’s picture

subscribe

ZuluWarrior’s picture

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

codesmith’s picture

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

codesmith’s picture

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!

ZuluWarrior’s picture

@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

jrabeemer’s picture

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

codesmith’s picture

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

effulgentsia’s picture

Status: Active » Needs review
FileSize
2.02 KB

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.

aaron’s picture

Status: Needs work » Needs review
FileSize
1002 bytes

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.

Lukas von Blarer’s picture

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.

Lukas von Blarer’s picture

#54 doesn't fix the issue.

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

aaron’s picture

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.

aaron’s picture

This one uses the correct file_info_file_types().

tsvenson’s picture

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

tsvenson’s picture

Status: Needs review » Needs work

Just noticed I forgot to change status. Bummer.

Dave Reid’s picture

Component: Code » WYSIWYG integration
Dave Reid’s picture

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

Dave Reid’s picture

Priority: Critical » Normal

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

arthurf’s picture

Priority: Normal » Critical
FileSize
997 bytes

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.

Dave Reid’s picture

Priority: Critical » Major
Issue tags: +sprint, +Media Initiative
John Pitcairn’s picture

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.

Dave Reid’s picture

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

lsolesen’s picture

Status: Needs work » Needs review
FileSize
855 bytes

Rerolled patch.

redndahead’s picture

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'),
);
lsolesen’s picture

Status: Needs work » Needs review
FileSize
768 bytes
lsolesen’s picture

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

lsolesen’s picture

Status: Needs work » Needs review
FileSize
1.3 KB
redndahead’s picture

Status: Needs review » Needs work

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

lsolesen’s picture

Status: Needs work » Needs review
FileSize
1.22 KB

Rerolled.

Dave Reid’s picture

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

$form['array_filter'] = array('#type' => 'value', '#value' => TRUE);
aaron’s picture

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

aaron’s picture

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

mrfelton’s picture

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.

mrfelton’s picture

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.

ParisLiakos’s picture

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?

avolve’s picture

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

mrfelton’s picture

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.

ParisLiakos’s picture

Status: Needs review » Needs work

per #80

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

ParisLiakos’s picture

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

ParisLiakos’s picture

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

ParisLiakos’s picture

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.

ParisLiakos’s picture

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.

ParisLiakos’s picture

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

ParisLiakos’s picture

Status: Needs work » Needs review
FileSize
4.18 KB

Removed misleading comment

Status: Needs review » Needs work

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

ParisLiakos’s picture

Status: Needs work » Needs review
jacobroufa’s picture

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

jacobroufa’s picture

Status: Needs review » Reviewed & tested by the community

double-posted... dumb internets. sorry.

ParisLiakos’s picture

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!

ParisLiakos’s picture

ParisLiakos’s picture

Assigned: Unassigned » Dave Reid

I would like Dave to review #91 before committing this

ParisLiakos’s picture

rerolled patch after latest commits

ParisLiakos’s picture

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.