Mediapool

We encourage users to post events happening in the community to the community events group on https://www.drupal.org.
j. ayen green's picture

I didn't have time to float the idea beforehand, because this was a module created for a client site, which I've now cleaned up and released.

Mediapool is used to fill a placeholder in a node with a random taxonomy-driven piece of media when the node is displayed. The initial (D6) release contains Imagepool for images.

So, the module creates an Imagepool content type, into which any number of images can be added. It also creates a taxonomy vocabulary, and a term is assigned to the newly created pool (piece of Imagepool content).

The admin settings for the module allow the content types to be identified that will be affected, and then for each of those content types, the applicable field (imagefield) is selected from a select widget.

For example, if I have a content type Event, which has an image field, field_event_image. In the admin settings for the module I would check the box for Event, and on the following page select field_event_image from the select box for Event.

I would then create a piece of Imagepool content, put a few images in, and perhaps tag the content as 'spring events.'

Then, if I create a piece of event content that relates to spring, I can leave the image field without an image, enter 'spring event' in the content's Imagepool category field, and when the node is displayed, an image will be selected at random from the image pool I'd created with the same tag and inserted into the empty image field for display.

You can find the new module at http://drupal.org/project/mediapool

Comments

Interesting, though if I'm

Garrett Albright's picture

Interesting, though if I'm following you correctly, the same effect could be achieved using Views with arguments and the random sort filter. Admittedly, sometimes it takes a while for people to be able to wrap their heads around the concept of Views arguments, but other than that, care to comment on how your approach differs?

Also, this isn't Twitter, so no need to add pound signs before your tags - you actually break tags that way, since no other tags have pound signs in front of them. Also, tags of "content management," "drupal" and "php" are sort of redundant on a site about Drupal. :P

I don't see doing it with

j. ayen green's picture

I don't see doing it with views. I use them for many things, and have published about them... it's not that arguments elude me (though there seems always to be something new to learn about using them). The reason is that this is meant to be transparent, so not needing to use a view in place of simply presenting a node. That said, it also works with nodes being presented in a view.

The randomness part of it isn't the focus. It's that the random image is being pulled from a categorized pool, and pulled from the pool only when the node is supposed to have an image but does not. Then, it is done transparently.

So, I may have 3 nodes dealing with business services, and one of those is about the client relationship...a theme that comes up often. There may be a pool of several images of a sales person meeting with a client, or shaking hands with a client. I could set up a view to randomly pull that image from a pool, but then it would, in my opinion, be ugly logic in terms of accounting for the possibility that a selected node -has- an image which should be shown with it, or doesn't have one and thus needs one shown in the same position in place of the one that isn't there. I think that approach is shaky, and is asking a lot of the typical content editor. With this module, the node is simply flagged as being of a particular category, and if the image is present, nothing happens...if not, when the node is shown, it has one transparently pulled from the pool and placed in the node during display.

Planned is to have videopool ... which will do the same thing along with generating the embed code

Yup...you caught me with the twitter tags, and having Drupal is beyond redundant :)