Get node entity in region template

Hello,
I am designing a theme that has a header image on some pages. The ‘page’ content type has an image field, which is pulled into views and thrown in a block at the top of the page. However, some pages don’t have this image, and the design calls for a border line when the image does not exist.

So — I’d like my main content region to know if this image exists and add appropriate style classes if not.

What do I need to do in my template_preprocess_region function? I can’t find the appropriate variables for this case. I was thinking something like the following:

function THEME_preprocess_region(&$vars) {
  if ($vars['elements']['#region'] == 'content' && IMAGE IN BLOCK EXISTS) {
    $vars['print-line'] = TRUE;
  }
  else {
    $vars['print-line'] = FALSE;
  }
}

Thanks for the help!!

Drupal version: 


Source: https://www.drupal.org/taxonomy/term/3/feed