Get an image with style url from an URI in twig
You could put the php code in the preprocess function of the field template. You have all information you need in your question.

But then you would do coding, that is already in drupal. If you have #image-style set in the image render element, then the image field should be configured for the preprocess functions that come later in the image-formatter and image-style templates to put the right src attribute in the variables for image-style.html.twig. So you can use the code that is already there by overriding this template.

See the code in /core/module/image/image.module:

function template_preprocess_image_style(&amp;$variables) {
  $style = ImageStyle::load($variables['style_name']);

  // Determine the dimensions of the styled image.
  $dimensions = array(
    'width' =&gt; $variables['width'],
    'height' =&gt; $variables['height'],
  );

  $style-&gt;transformDimensions($dimensions, $variables['uri']);

  $variables['image'] = array(
    '#theme' =&gt; 'image',
    '#width' =&gt; $dimensions['width'],
    '#height' =&gt; $dimensions['height'],
    '#attributes' =&gt; $variables['attributes'],
    '#uri' =&gt; $style-&gt;buildUrl($variables['uri']),
    '#style_name' =&gt; $variables['style_name'],
  );