Mikhail Ismajlov 08/11/2019

In this article, we will analyze the settings for Image Styles, File system and image toolkit.

Drupal 8 multimedia

If you looked at my past articles, then you are probably already familiar with the Image Styles and visited the Media settings. But if you have not had time, then we will do it now. Let's go to the Configuration - Media - Image Styles page:

Drupal 8 image styles

Here we see the default three styles Thumbnail, Medium, Large. We apply these styles to display images attached to nodes, comments, taxonomy terms, user avatars, to everything where there are fields with the Image type. We set the sizes of the images that we need, and Drupal does the rest of the work. Let's create a new style of 300 by 300 pixels. Click the + Add image style button. I advise you to name image styles in two ways: the first is called based on the size of the image 300x300 or based on where this image will be displayed, for example article image.

Let's create a new style for the Article image.

Drupal 8 new image style

Size 300x300

drupal 8 sizes

And now we can use this style to display images in articles. Let's go into the display settings for the fields of the content type Article.

/admin/structure/types/manage/article/display

drupal 8 presets

Let's go into editing the Image field and indicate our new image style.

Drupal 8 image styles

Click the Update button and then Save.

You can also create and specify a separate image style for the article teaser.

Drupal 8 file system

/admin/config/media/file-system

drupal 8 files

On this settings page, we can set in which folder our files downloaded through Drupal are stored. When you install Drupal, you must create a folder with the ability to write Drupal to it (chmod 777 for systems on Linux), this folder is written in the Drupal settings file:

/sites/default/settings.php

By default, all files are written to / sites / default / files. Everything should work correctly here, if you have rights to the 777 folder.

Further we can change the temporary directory. Permissions on the temporary folder must be such that Drupal can write files there. If you have problems with the temporary folder and Drupal gives an error, then try to use the / sites / default / files directory as temporary, because it has 777 permissions and Drupal can write files there.

Default download method. Here in previous versions of Drupal, you could choose to access files through Drupal, but apparently now this is not implemented and the files are transferred directly from the server without the participation of Drupal.

Image toolkit

drupal 8 image processing tools

When we upload pictures to Drupal, then Drupal processes them in accordance with this parameter. This is done to save space on the hosting (server), JPEG images can be compressed with low quality loss. If we set 100 percent, then Drupal will not process them, but will issue them as is. But even if you change the JPEG quality to 85%, pictures can be compressed twice and practically without loss of quality.