You are here

function responsive_background_get_images in Responsive Background Images 7

Custom function

  • gets the image file id from file_managed table and render the smallest set version of the image
1 call to responsive_background_get_images()
responsive_background_process_html in ./responsive_background.module
Implements hook_process_html().

File

./responsive_background.utils.inc, line 18
Responsive Background Utilities

Code

function responsive_background_get_images() {
  global $_responsive_background_set;
  $settings = $_responsive_background_set;
  $images = $settings['images'];
  $rendered_images = array();

  // get the smallest image
  $style = $settings['bp320'];
  if (!empty($style)) {
    foreach ($images as $key => $image_fid) {
      if ($image_fid != 0) {

        // get the file from file_managed IDs
        $image = file_load($image_fid);

        // get the rendered image style
        $rendered_images[] = image_style_url($style, $image->uri);
      }
    }
  }
  else {
    drupal_set_message(t('Please configure your Responsive Background image styles.'));
  }
  return $rendered_images;
}