Upgrade Your Drupal Skills

We trained 1,000+ Drupal Developers over the last decade.

See Advanced Courses NAH, I know Enough

Media - File Styles Roadmap

Parent Feed: 
Share this

This past month I've been busy getting the Styles module ready for release. This module does the heavy lifting for display of Media objects. For those that don't know yet, Media, the File Browser to the Internet, is the future of media handling for Drupal 7. It exposes the underlying streams API of Drupal core, allowing for fieldable media entities (fields on files), mixing up images and audio, local files and YouTube.

File Styles for Drupal

Basically, the Styles module allows you to select a style for display with a field (or in a View or with WYSIWYG), and the field will be displayed as determined by the predetermined criteria. For instance, as shown in the above diagram, you might set the display as 'Medium', and the actual displayed file or remote stream will be selected according to the file's mime type (as an image, a video, in an mp3 player, etc).

The UI

The tricky part has been creating the UI for this. We're just about there -- you can finally create and modify styles with the supplied Styles UI module.

File Styles menu item

You can add new styles, and modify the provided styles.

File Styles listing

When editing the style, you'll note all the 'containers' to the left (Image, Audio, YouTube, etc.), with a preview of its display. Just select the preset for that container/style combo, and you're set.

Edit File Styles

However, we still need to add a way to create and edit the presets themselves. As an example, you might want to create a preset for images that will display a Medium image style linked to the original media, or a YouTube thumbnail that will popup the video in a ColorBox when clicked.

Technically, this isn't too difficult (and is on the way). However, from the stand-point of the administrator, this has been a bit of a stumbling block. Though I'm leaning towards doing some in-place editing of presets within this same screen. (For that matter, we could even go so far as moving this entire screen, perhaps as a dialog, within the media field display screen.) At the same time, I'm afraid of clutter; the concept is hard enough to explain as it is. I'd love to hear from anyone with more of an eye towards UX for the administrator.

Thoughts? Comments?

Author: 
Original Post: 

About Drupal Sun

Drupal Sun is an Evolving Web project. It allows you to:

  • Do full-text search on all the articles in Drupal Planet (thanks to Apache Solr)
  • Facet based on tags, author, or feed
  • Flip through articles quickly (with j/k or arrow keys) to find what you're interested in
  • View the entire article text inline, or in the context of the site where it was created

See the blog post at Evolving Web

Evolving Web