Digital Asset Management for all your ProcessWire media

Media Manager Objects

MediaManagerArray

A Media Manager field returns and object of type MediaManagerArray. This is a WireArray derived object. This means that you also have at your disposal all the powerful methods inherent in the WireArray class.

Similar to a WireArray object, a MediaManagerArray object requires traversal to access its collections. Each item in a MediaManagerArray is an object of type MediaManager.

MediaManager Object

Each MediaManager object has the following 6 basic properties.

Saved (database) properties

These 2 properties are saved for each MediaManager object:

  1. id: page ID of the page where the media lives (hidden in admin and not important to know about)
  2. type: integer denoting media type (1=audio; 2=document; 3=image [for variations this will be 3x, where x is the number of the variation of an original image]; 4=video)

Runtime

The following 4 properties are generated at  runtime, i.e. when a Media Manager field is accessed.

  1. typeLabel: User-friendly string denoting media type. These are audio, document, image or video.
  2. media: A ProcessWire Pagimage object for image media or Pagefile object for audio, document and video media types. The objects include all their properties including ext, filesizeStr, height, width, description, tags, filename, basename, etc. Please note that for image media, this is the first image in the images field (media-manager-image) attached to its Media Manager template.
  3. mediaField:  This returns the media field attached to the Media Manager template. For image media, this is a Pageimages object. For audio, document and video media, this is a Pagefile object.
  4. title: Title of the media (please note that this is the title of the hidden admin page where the media actually lives. It may or may not be the same as the name of the media file itself. This can be used as a user-friendly name for your media.

Custom Properties

In addition to the above properties, any additional ProcessWire fields you add to any of the Media Manager templates will be returned in a MediaManager object as $object->name_of_the_field. For instace, a field named date added to the template media-manager-image will be available as $object->date for all media of type image. Please refer to the section on custom properties for more information.