Seminar+Write-up+-+Media+Module

=** The Media Module in Drupal **=

**Overview**
The Media module acts as an extension of Drupal core's upload field, and is used to upload and manage files and multimedia. It is often referred to as the best way to handle media (images/video/audio) files in Drupal. The media module was created to solve Drupal's long standing problem with handling media.

Currently, there are several media- and file-management related modules, which has led to a lot of duplicated code and conflicting implementations. The media module provides an extensible framework and a unified user interface, that helps to bring together many of the current multimedia and file managing efforts, and acts as a base for future development.

Installation is fairly simple. Visit [] and download and install the module as usual.
 * Installation**

The CTools module is also required for the Media Module to work, and this can be downloaded from here: [].

**What is the Media Module?**
Media module allows users to upload media files from their computers, browse files that are already on the server, and even pull in files from external sites such as YouTube and Flickr. It works by providing a file browser for your web site that allows editors to easily access and insert local files and remote streams into fields and text areas.

__Required modules for Media:__ Chaos tool suite File entity Views Styles Embedded Media Field

__Recommended modules for Media:__ Media: YouTube Media: Flickr Wysiwyg Media Gallery Media Browser Plus MediaElement Multiple forms Plupload oEmbed Remote stream wrapper

Media Module provides an easy to use, WYSIWYG integrated experience for adding and handling any images, audio and video files, something that Drupal 7 core isn't good enough at its own.

**File types**
The Media module is able to support a vast range of files despite whether or not they are in your local file system. It can be done through uploading through Drupal and importing into the system or by linking them from another site by pasting the url. The Media module on Drupal supports a variety of file formats ranging from text document to images, audio, and movie formats such as jpg, gif, doc, xls, pdf, ppt, mp3, mov, mpeg, avi, etc. The field type shown below determines the types of media it allows you to upload. The Media module allows a unified interface for managing any types of media files and metadata.



**The Media Library**
Media that is imported through the media module gets stored in a **media library**.

The **media library** can be accessed through Administration >> Content, and then clicking on the "Media" tab on the right-hand side of the page.





To **add content**, click on "+Add file". This leads to a screen with an "Upload file" dialog box.

To **delete content**, there are two different ways to do it based on whether you are deleting a single file, or multiple files.

For a single file, click on the file from the media library, then click on the "delete" tab.

To delete multiple files at the same file, select the images to delete, then select "delete" from the operations drop-down menu.

To access the media library when adding content to a node: 1. Go to Structure > Content types, and click on "Manage Fields" next to a content type 2. For "Image" or "File" fields, a new selection, "Media file selector", will be available under "Widget":

4. Now, when you add content for this content type, a "Select Media" button will be available for this field 5. Clicking on "Select Media" will let you upload new files as usual or, more importantly, let you select files from the media library

**Example: Media module to import Youtube videos**
First and foremost, you need to make sure you have the media module installed. After that, we need to install 2 important modules:

1) The Embedded Media Field module (http://drupal.org/project/emfield) 2) Media: YouTube module (http://drupal.org/project/media_youtube)

Install and enable both of those modules.

Then, go to structure > content types and add a multimedia asset field.

As you choose the settings, make sure you check mark both Video and YouTube boxes. Click Save to save the new field.

There is one more important thing you must now do to make sure that the videos display.

Go to Structure > content types > manage fields and Click on Manage Display at the top of page

Normally settings for the video field would be available but in this case you must click Save before they appear. Then you can click the cog on the right side, next to the YouTube video field

Set the file view mode to Large and click Update and Save afterwards so new settings aren’t lost.

Now you need to go to Add content and use the new YouTube video field.

Once you’ve inserted the YouTube URL and clicked submit, you should see a video thumbnail as in the image below

Make sure you Save the content and your video will be showing on your site

And Voila, You're Done!

**WYSIWIG Integration**
WYSIWIG refers to "What you see is what you get." This means that while editing text and other content, the user interface of the editing process shows exactly how the content will look when published. Two popular WYSIWYG editors for drupal include the **CKEditor module** and the **WYSIWYG module** (which lets you run multiple editors including CKEditor). The **Media Module** can be integrated with both of these modules allowing users to access and publish their media library through the ease of a WYSIWYG editor.

The following guide instructs how the **Media Module** can be integrated with **CKEditor**.

Assuming the Media module has already been installed, the next module that you need to install is CKEditor. To do this, visit the CKEditor download page and Right Click > Copy Link Location the latest tar.gz.



Next, go to your Drupal 7 site and from the top bar, select Modules > Install New Module and paste the copied URL into the box, then click Install.



Now go to back to the Modules list and scroll down to User Interface section. Make sure the CKEditor module is checkmarked and click Save.



Now that you have CKEditor installed, you can test it out by selecting Add Content > Basic Page. You will also see that there is no option here for you to add content from your Media module library. We will need to enable that next.

To integrate your Media module library into the CKEditor, select Configuration in the top bar and in the Content Authoring section, select CKEditor. The following page will have these items.



Select the edit option for Filtered HTML, and in the next page, go to the Editor Appearance section. From here, enable “Plugin for inserting images from Drupal media module.”



Also, make sure the media button was added to the Used buttons section.



Now Save and choose to edit Full HTML. Just like before, go to Editor Appearance section and enable “Plugin for inserting images from Drupal media module,” then Save it.

To test this out, select Add Content > Basic Page, and you will see an “Add Media” button has been added to CKEditor. This button allows you to add content using the Media module and has access to your Media module library.



You now have the Media module integrated with CKEditor.