In this exercise you will upload an image directly to the media library (Part 1) and then use that image when creating content (Part 2).
Navigate to the Media page by clicking on Content then Media on the Admin menu.
Click the Add Media button at the top left of the page.
Click Image to upload an image file.
Upload an image file:
Give it a short, descriptive name.
Choose a file from your computer, using the Browse button.
Click Open to upload the file.
Add Alt text.
Note Image alt text is required to enable screen readers and facilitate vision-impaired people.
Click Save
Create a new Page following the instructions in Exercise 3.1
Click on Banner and then expand "Banner featured image". There you will see an Add media button. Note - you may not have a "Banner" tab if you are not using CivicTheme. In that case, find any Media upload field and use that.
Select the image and then click on Insert selected.
Once the image is selected you will see a preview in your content like the this screenshot:
Fill out any required fields for your Page and click the Save. The image now appears on the frontend. The location of the image may be different on your site depending on your theme.
Navigate to Content → Files from the Admin menu and locate the image file you uploaded. It should be at the top of the list as it is the most recently added file. Note the name of the file.
Next, click on the Media tab button and locate the Media entity that that points to the file you uploaded.
Discuss with the trainer, why the Name of the file (from the Files tab) is different to the Media name (from the Media tab).
Tip: The Media entity allows you to enter a more user-friendly Name (and other metadata) rather than using the name of the file.
In this exercise, you will learn how to use Bulk actions operations.
To complete this exercise you may need a few files - such as images or PDFs. You can download some from your website, from https://www.istockphoto.com/au/stock-photos or use some files on your local machine.
Let’s learn how to use the Bulk operations functionality to manage Media.
Navigate to the Content → Media page from the Admin menu
Select the Media entities using the checkboxes to the left of the Thumbnails.
Select Delete media from the Action dropdown.
Click the Apply to selected items button.
You will be directed to a page asking if you are sure you want to delete the items. Confirm the action by clicking the Delete button. This will remove all the selected Media entities from your training site.
Tip: Don’t link or embed files directly by modifying HTML in your pages. Always use GovCMS functionality to add or upload Media. This ensures that links or images stay valid if a file is deleted from your site.
Warning - If you delete media, then those media will go missing from the content that were using them. Be careful when deleting media as this can break the design of those pages.
GovCMS provides a central media library, where all media assets, such as images, documents and other files are stored.
Depending on the type of media asset, a corresponding type of media should be used.
By default, GovCMS provides the following Media types:
Audio
File
Image
Remote Video
Video
Each Media type can have various forms and display fields configured.
To access the Media Library, click on Content in the Admin menu then hover over Media and click on Media Library.
The main elements of the Media Library page and their functions are:
Add media
Table and Grid tabs. These allow switching between views of Media
A search and filtering area
A Media listing table that displays the Media entities matching the filtering criteria, or lists all Media entities if no filters are applied.
Bulk operations
These elements are highlighted and numbered on the screenshots below.
The Add media button allows you to add new Media assets to the site.
The Filters allow you to filter and search the media library for an existing media asset.
The Bulk operations area allows you to implement bulk operations on multiple media assets. For example, you can use the checkboxes to select multiple media assets, then delete all selected media assets at by clicking the Apply to selected items button.
To add media to the Media Library, click the +Add media button at the top left of the Media Library page.
Note This can also be performed by clicking Content → Add media when currently not on the Media Library page.
This brings you to a page that lists all media types available on the site. Click the appropriate media type, for example Image.
Fill out all required fields. Providing some tags and a Revision log message can help manage large media libraries. Save the Media.
The main advantage of having the central media library is reusability - the same media asset can be included in multiple content pages.
Media assets that were uploaded to the site directly from content (such as by uploading an image into the Rich Text Editor) will appear in the central Media library and can be also reused on other pages on the site.
When creating or editing content via a content form (e.g. the Page form) the form includes an area to upload a thumbnail image.
When you click on the Add media button from the content form, an overlay window opens showing a list of available media to select from the media library.
Click on Select files to open a file browser, or drop files on the highlighted area.
Note The Files page is rarely used by users, and there is a proposal to remove this page from Drupal / GovCMS in future.