james gollan d.o: gollyg twitter: gollyg. overview files in drupal 7 the media suite of modules site...
TRANSCRIPT
![Page 1: James Gollan d.o: gollyg twitter: gollyg. Overview Files in Drupal 7 The media suite of modules Site recipe: Adding media to your site](https://reader035.vdocuments.site/reader035/viewer/2022062715/56649d765503460f94a576d6/html5/thumbnails/1.jpg)
James Golland.o: gollygtwitter: gollyg
QuickTime™ and aDVCPRO - PAL decompressor
are needed to see this picture.
![Page 2: James Gollan d.o: gollyg twitter: gollyg. Overview Files in Drupal 7 The media suite of modules Site recipe: Adding media to your site](https://reader035.vdocuments.site/reader035/viewer/2022062715/56649d765503460f94a576d6/html5/thumbnails/2.jpg)
Overview
• Files in Drupal 7
• The media suite of modules
• Site recipe: Adding media to your site
![Page 3: James Gollan d.o: gollyg twitter: gollyg. Overview Files in Drupal 7 The media suite of modules Site recipe: Adding media to your site](https://reader035.vdocuments.site/reader035/viewer/2022062715/56649d765503460f94a576d6/html5/thumbnails/3.jpg)
![Page 4: James Gollan d.o: gollyg twitter: gollyg. Overview Files in Drupal 7 The media suite of modules Site recipe: Adding media to your site](https://reader035.vdocuments.site/reader035/viewer/2022062715/56649d765503460f94a576d6/html5/thumbnails/4.jpg)
![Page 5: James Gollan d.o: gollyg twitter: gollyg. Overview Files in Drupal 7 The media suite of modules Site recipe: Adding media to your site](https://reader035.vdocuments.site/reader035/viewer/2022062715/56649d765503460f94a576d6/html5/thumbnails/5.jpg)
![Page 6: James Gollan d.o: gollyg twitter: gollyg. Overview Files in Drupal 7 The media suite of modules Site recipe: Adding media to your site](https://reader035.vdocuments.site/reader035/viewer/2022062715/56649d765503460f94a576d6/html5/thumbnails/6.jpg)
![Page 7: James Gollan d.o: gollyg twitter: gollyg. Overview Files in Drupal 7 The media suite of modules Site recipe: Adding media to your site](https://reader035.vdocuments.site/reader035/viewer/2022062715/56649d765503460f94a576d6/html5/thumbnails/7.jpg)
QuickTime™ and aH.264 decompressor
are needed to see this picture.
![Page 8: James Gollan d.o: gollyg twitter: gollyg. Overview Files in Drupal 7 The media suite of modules Site recipe: Adding media to your site](https://reader035.vdocuments.site/reader035/viewer/2022062715/56649d765503460f94a576d6/html5/thumbnails/8.jpg)
Files in Drupal 7
![Page 9: James Gollan d.o: gollyg twitter: gollyg. Overview Files in Drupal 7 The media suite of modules Site recipe: Adding media to your site](https://reader035.vdocuments.site/reader035/viewer/2022062715/56649d765503460f94a576d6/html5/thumbnails/9.jpg)
Drupal 7 - File entities
• Files in Drupal 7 are handled as entities
• Files are attached using a file field (or an image field)
• This creates an entity reference to the file
![Page 10: James Gollan d.o: gollyg twitter: gollyg. Overview Files in Drupal 7 The media suite of modules Site recipe: Adding media to your site](https://reader035.vdocuments.site/reader035/viewer/2022062715/56649d765503460f94a576d6/html5/thumbnails/10.jpg)
Managed vs unmanaged files
• The File API provides functionality for working with files
• Files can be 'managed' or 'unmanaged'
• Managed files have a corresponding entry in the 'file_managed' table
• Operations on managed files update this table
• Unmanaged files are not 'known' to Drupal, and cannot be referenced or re-used (except via raw links)
![Page 11: James Gollan d.o: gollyg twitter: gollyg. Overview Files in Drupal 7 The media suite of modules Site recipe: Adding media to your site](https://reader035.vdocuments.site/reader035/viewer/2022062715/56649d765503460f94a576d6/html5/thumbnails/11.jpg)
Stream wrappers
• A stream is simply a resource object
• Drupal stream wrappers are an extension of PHP's stream wrapper functionality
• Stream wrappers are referred to using a standard pattern:
scheme://target
• core stream wrappers include:
• public://
• private://
• temp://
• PHP also provides a number of stream wrappers
![Page 12: James Gollan d.o: gollyg twitter: gollyg. Overview Files in Drupal 7 The media suite of modules Site recipe: Adding media to your site](https://reader035.vdocuments.site/reader035/viewer/2022062715/56649d765503460f94a576d6/html5/thumbnails/12.jpg)
File usage
• Drupal 7 tracks file usage, and will lock a file that is currently in use by making an entry in the 'file_usage' table
• "In use" means that it is referenced from a node
• This prevents accidental file deletion, and allows for better file management
![Page 13: James Gollan d.o: gollyg twitter: gollyg. Overview Files in Drupal 7 The media suite of modules Site recipe: Adding media to your site](https://reader035.vdocuments.site/reader035/viewer/2022062715/56649d765503460f94a576d6/html5/thumbnails/13.jpg)
That's all great, but...
• File entities are NOT field-able
• File entities are not easily re-usable
• There is no interface for managing file entities
• enter...
![Page 14: James Gollan d.o: gollyg twitter: gollyg. Overview Files in Drupal 7 The media suite of modules Site recipe: Adding media to your site](https://reader035.vdocuments.site/reader035/viewer/2022062715/56649d765503460f94a576d6/html5/thumbnails/14.jpg)
The Media module
![Page 15: James Gollan d.o: gollyg twitter: gollyg. Overview Files in Drupal 7 The media suite of modules Site recipe: Adding media to your site](https://reader035.vdocuments.site/reader035/viewer/2022062715/56649d765503460f94a576d6/html5/thumbnails/15.jpg)
Media Module
“Media's aim is to solve Drupal's long standing media handling problem.”
“The framework provided by the Media module is helping to unify many of the current multimedia and file efforts, acting as a springboard to future development.”http://drupal.org/documentation/modules/media
![Page 16: James Gollan d.o: gollyg twitter: gollyg. Overview Files in Drupal 7 The media suite of modules Site recipe: Adding media to your site](https://reader035.vdocuments.site/reader035/viewer/2022062715/56649d765503460f94a576d6/html5/thumbnails/16.jpg)
Current state
Media currently has 2 main branches:•7.x-1.x (currently at RC3)•7.x-2.x (currently unstable)
•dependency on file_entity module...
![Page 17: James Gollan d.o: gollyg twitter: gollyg. Overview Files in Drupal 7 The media suite of modules Site recipe: Adding media to your site](https://reader035.vdocuments.site/reader035/viewer/2022062715/56649d765503460f94a576d6/html5/thumbnails/17.jpg)
File entity module
• Makes files field-able. (Yay)!
• Makes files re-usable. (Yay * 2)!
• Provides an administrative interface for files on the system
• Provides a UI for managing file display modes
![Page 18: James Gollan d.o: gollyg twitter: gollyg. Overview Files in Drupal 7 The media suite of modules Site recipe: Adding media to your site](https://reader035.vdocuments.site/reader035/viewer/2022062715/56649d765503460f94a576d6/html5/thumbnails/18.jpg)
File_entity module (cont.)
• Defines 6 file_entity bundles, based upon common MIME types:
• video
• image
• audio
• text
• application
• other
• Places files into one of the above bundles, based upon file extension
![Page 19: James Gollan d.o: gollyg twitter: gollyg. Overview Files in Drupal 7 The media suite of modules Site recipe: Adding media to your site](https://reader035.vdocuments.site/reader035/viewer/2022062715/56649d765503460f94a576d6/html5/thumbnails/19.jpg)
Media module
• Provides a unified and extensible widget for handling file uploads
• Provides a formatter for displaying file_entities of any type
• Provides various api functions for integrating with core file handling, file styles, stream wrappers, and making the whole system pluggable with extra file providers
![Page 20: James Gollan d.o: gollyg twitter: gollyg. Overview Files in Drupal 7 The media suite of modules Site recipe: Adding media to your site](https://reader035.vdocuments.site/reader035/viewer/2022062715/56649d765503460f94a576d6/html5/thumbnails/20.jpg)
Site recipe: Adding media to your site
![Page 21: James Gollan d.o: gollyg twitter: gollyg. Overview Files in Drupal 7 The media suite of modules Site recipe: Adding media to your site](https://reader035.vdocuments.site/reader035/viewer/2022062715/56649d765503460f94a576d6/html5/thumbnails/21.jpg)
Setup
• Use the following modules:
• Media (7.x-2.x branch)
• mediaelement (mediaelement 7.x-1.x-dev)
• libraries
• media_youtube
• ckeditor (the library, not the module)
• wysiwyg
• file_element
![Page 22: James Gollan d.o: gollyg twitter: gollyg. Overview Files in Drupal 7 The media suite of modules Site recipe: Adding media to your site](https://reader035.vdocuments.site/reader035/viewer/2022062715/56649d765503460f94a576d6/html5/thumbnails/22.jpg)
Setup
• Oh, and this patch :-|
• http://drupal.org/node/1141374
• and this extra little bit of code...
• https://gist.github.com/1124045
![Page 23: James Gollan d.o: gollyg twitter: gollyg. Overview Files in Drupal 7 The media suite of modules Site recipe: Adding media to your site](https://reader035.vdocuments.site/reader035/viewer/2022062715/56649d765503460f94a576d6/html5/thumbnails/23.jpg)
Configure the node bundle
• Add a file field to a content type
• Select the 'media' formatter
• From the node display page, set the file field display configuration to ‘Media’ and choose an appropriate view mode for the field display
![Page 24: James Gollan d.o: gollyg twitter: gollyg. Overview Files in Drupal 7 The media suite of modules Site recipe: Adding media to your site](https://reader035.vdocuments.site/reader035/viewer/2022062715/56649d765503460f94a576d6/html5/thumbnails/24.jpg)
Configure the file display
• Visit the file management screen.
• From the ‘Manage file display’ link, assign the correct formatters for the file. Note that you can assign more than one formatter to a file - the first applicable formatter will be applied.
• Change the display on the node type to refer to the correct display mode.
![Page 25: James Gollan d.o: gollyg twitter: gollyg. Overview Files in Drupal 7 The media suite of modules Site recipe: Adding media to your site](https://reader035.vdocuments.site/reader035/viewer/2022062715/56649d765503460f94a576d6/html5/thumbnails/25.jpg)
Adding metadata
• Visit the file management screen.
• From the ‘Manage fields’ link. Add any fields that you want on the file bundle.
• Change the display on the node type to refer to the correct display mode.
![Page 26: James Gollan d.o: gollyg twitter: gollyg. Overview Files in Drupal 7 The media suite of modules Site recipe: Adding media to your site](https://reader035.vdocuments.site/reader035/viewer/2022062715/56649d765503460f94a576d6/html5/thumbnails/26.jpg)
Configure input formats and CKeditor
• Download CKeditor to libraries folder
• Add media filter
• Add button to CKeditor
• Enable correct input format
![Page 27: James Gollan d.o: gollyg twitter: gollyg. Overview Files in Drupal 7 The media suite of modules Site recipe: Adding media to your site](https://reader035.vdocuments.site/reader035/viewer/2022062715/56649d765503460f94a576d6/html5/thumbnails/27.jpg)
Drawbacks
• File access still not implemented
• Files inserted via the WYSISYG are not inserted into the file_usage table, meaning that accidental deletion is possible, and there is no easy way of auditing these files
• No option to add meta-data when uploading a file
• Browsing a large number of files in the widget difficult
• Many functions and features still a *bit* fragile (currently over 100 open bugs)
![Page 28: James Gollan d.o: gollyg twitter: gollyg. Overview Files in Drupal 7 The media suite of modules Site recipe: Adding media to your site](https://reader035.vdocuments.site/reader035/viewer/2022062715/56649d765503460f94a576d6/html5/thumbnails/28.jpg)
Find out more•http://drupal.org/media•http://drupal.org/mediaelement•http://drupal.org/documentation/modules/media•irc: #drupal-media
![Page 29: James Gollan d.o: gollyg twitter: gollyg. Overview Files in Drupal 7 The media suite of modules Site recipe: Adding media to your site](https://reader035.vdocuments.site/reader035/viewer/2022062715/56649d765503460f94a576d6/html5/thumbnails/29.jpg)
QuickTime™ and a decompressor
are needed to see this picture.