Is there a way to get multiple image sizes from a single image? In Drupal 8 Manage display for the image field, I can assign only one image style.

I have two image styles: thumbnail and medium.

when I upload an image through image uploader, I need to view my uploaded image in those two image styles. 

Is there a way to show the image in those two sizes from the single image I have uploaded?

If I selected thumbnail in the manage display on the image field it will save the image as thumbnail, but not as medium size as well. I need to save the image 
 in both the sizes, or I need to get both the styled images from the single image I upload. The following code can get the image for the given style in manage display.

$imageStyle = ImageStyle::load('medium');
$galleryImage = $imageStyle-&gt;buildUri($image-&gt;entity-&gt;getFileUri());
By default, any file you upload via the file field goes into the public files directory /sites/default/files. And you can choose to apply any image style to the same image and configure it separately per display.

E.g. Let's say you upload an image with name my_beatiful_cat.jpg from a file field on a node page.


The image by default will stay at sites/default/files/my_beatiful_cat.jpg.
From manage display of the content type, in the default view, let's say you choose the image style to be medium and save.
When you view the node, a new image will be created from the uploaded image at sites/default/files/styles/medium/public. So, you will have a file sites/default/files/styles/medium/public/my_beatiful_cat.jpg which will have the dimensions as per the image style applied.
This is true for any other image style that you apply for any other display.


So, you only upload an image once. Image styles are responsible for generating images with respective sizes as per the configuration and the appropriate image file is rendered.