The media form field type provides modal access to the media manager for the choice of an image. Users with appropriate permissions will be able to upload files. If the user is not authorised to view or add media they will see an error page in the modal popup.
Example XML field definition:
<field name="myimage" type="media" directory="stories" />
This will open the media manager with the directory /images/stories/ already selected.
- type must be media.
- name is the unique name of the field.
- label (translatable) is the descriptive title of the field.
- description (translatable) is text that will be shown as a tooltip when the user moves the mouse over the drop-down box.
- directory is the directory from which the user will be able to choose a file. This attribute should be relative to the top level /images/ folder.
- preview shows or hides the preview of the currently chosen image. ("true": Show always, "tooltip": Show as tooltip, "false": Show never). Default is "tooltip".
- preview_width sets the max-width of preview image (default: "200").
- preview_height sets the max-height of preview image (default: "200").