How to get height and width of image style?
No Sssweat's answer inspired this. 

I added this before if statement (if($node_image-&gt;isEmpty())) to get the height and width. 

$image_style_config = (ImageStyle::load('medium')-&gt;getEffects()-&gt;getConfiguration());

foreach($image_style_config as $config) { 
  if(isset($config['data'])) {
    if(isset($config['data']['height'])) {
      $image_style_height = $config['data']['height'];
    }
    if(isset($config['data']['width'])) {
      $image_style_width = $config['data']['width'];
    }
  }
}