In the Event content type, we have an image field. The same image may display as a Thumbnail (left in the screenshot below) or Full content image (right in the screenshot below). The image is scaled down, resized and cropped. Each image has a copy stored in the filesystem.
Example: thumbnail | Example: Full content image |
---|---|
You may explore how the Event content type displays these images based on the Display Mode.
Navigate to Structure → Content types → Event → Manage display → Teaser Small.
Locate the Image field.
Explore how it’s rendered by using the Thumbnail Display mode from the Image Media entity (see previous exercise).
Image styles allow you to scale, crop and resize images without changing the original image. By default, in GovCMS seven sizes are defined:
Featured
Landscape
Large (480×480)
Linkit result thumbnail
Medium (220×220)
Square
Thumbnail (100×100)
The Thumbnail (100×100) style, for example, is shown with the teaser for image posts and Square is used when listing Events.
When you change an image style configuration, the image module automatically refreshes all created images.
Every image style must have a name, which will be used in the URL of the generated images. Image styles are generally named in one of three ways:
Using a generic style label/name, such as “Featured” or “Thumbnail”. This is the most flexible and can be reused in different locations.
Using its ‘location’ within the image style name, e.g. “Events Banner”.
Using the image size to name it, such as “Large (480×480)”.
You can name your image styles differently, but we recommend setting up a naming convention.