You are here

function dynamic_background_is_image_used in Dynamic Background 7.2

Helper function that can be used to detect if a given image is in usage.

Parameters

int $fid: File id.

Return value

int The number of times this image is used at the moment.

File

./dynamic_background.module, line 933
This module enables administrators to upload images used as background on the site. The selected background image link is exposed as either $background in the page.tpl file or as /background.css.

Code

function dynamic_background_is_image_used($fid) {
  $query = db_select('dynamic_background_usage', 'dbu');
  $query
    ->fields('dbu', array(
    'count(*)',
  ))
    ->condition('fid', $fid);
  return $query
    ->execute()
    ->fetchField();
}