Media Styles

aaron's picture

I'm adding display formatters to the Media module, and could use some feedback.

Basically, I'm taking the work from the Image Styles built into core (which is a port of Imagecache), and building a wrapper around it. A Media Style would be a collection of styles, based on the stream (public://, private://, youtube://, etc) and file mimetype (image/jpeg, image/png, etc.), that would be applied to a specific filefield display (either in the node teaser/page display, or a view field display, or possibly other places, such as inline).

As an example, you might have a 'small-box' Media style that contains a 'medium' image style, a 'preview' youtube style, and an 'inline' pdf style. Thus, if the filefield contained an image, it would display it with the image scaling, a youtube video with a small player, and a pdf would be displayed in an iframe. Undefined streams/mimetypes would fall back to the default file listing.

The module is intended to work stand-alone, with File, Image, and/or Media. Thus, one question I have is if it should be bundled with the Media module, or packaged outside the module. On the one hand, as it can be run w/o Media, it might be useful in other situations. On the other hand, I imagine 98% of Media users would also want this module, so I'm hesitant to create a new external dependency. I've mostly decided to bundle it with the Media module, but am open to new considerations I haven't had yet.

I've included two screen shots. The first screen shot at the top shows current functionality. Clicking on a radio will automatically load a new preview of the selected style (that part's not built yet, but that's the idea).

The second below was the original display for administration. It's now actually using vertical tabs, as with the first, but I'm including it since it gives a large overview (and is what it would look like w/o javascript anyway).

I'm mostly looking for feedback of how the administrative UI could be improved, as well as how to word instructions to the user that won't scare them off. Also, for any other conceptual, architectural, or other comments.

Thanks,
Aaron

(Cross-posted at http://aaronwinborn.com/blogs/aaron/media-styles.)

AttachmentSize
Media Styles administrative mockup50.82 KB
Media Styles administrative w/ vertical tabs37.96 KB

Comments

For the radio buttons, what

liberatr's picture

For the radio buttons, what if it was more human-readable, like:
width x height: 100 x 100, upscale is allowed
width x height: 300 x 400, upscale is not allowed

width x height: 320 x 240, autoplay is off
width x height: 480 x 385, autoplay is on

I really like the idea of being able to switch between different formatters based on the file type. I've written a few formatters in the past that did something similar.

Would there be a layer to this of configuring things with .tpl.php files? I guess the .tpl would just wrap around the value that gets spit out, and if we get things like classes and attributes, that can make the output easier to theme. Will the file type or stream type be reflected in the CSS / RDFa output?

I think making the module part of the package, but able to be enabled on its own, is a good path.

I'd like to see something similar applied to nodereference fields - allow me to choose a different formatter based on the node type I'm referencing...

Styles FTW!

aaron's picture

After some discussion here, at http://aaronwinborn.com/blogs/aaron/media-styles and on irc, I set up the Styles project to host this externally. Thanks for all the great suggestions! Most of them will find their way into the module.

By the way, some of the reasons for this is that I'm abstracting the architecture to be used for any type of field, not just File fields. For instance, one could create formatter styles for a node reference field that will format the display according to the referenced node type.

Aaron Winborn
Drupal Multimedia (my book, available now!)
AaronWinborn.com
Advomatic

File API

Group organizers

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds:

Hot content this week