You are here

public function sweaver_plugin_images::sweaver_get_image in Sweaver 7

Same name and namespace in other branches
  1. 6 plugins/sweaver_plugin_images/sweaver_plugin_images.inc \sweaver_plugin_images::sweaver_get_image()

Helper function to get image.

Parameters

$fid: The file id.

Return value

False or image object.

2 calls to sweaver_plugin_images::sweaver_get_image()
sweaver_plugin_images::sweaver_images_backend_form in plugins/sweaver_plugin_images/sweaver_plugin_images.inc
Images form.
sweaver_plugin_images::sweaver_images_confirm_form_delete in plugins/sweaver_plugin_images/sweaver_plugin_images.inc
Image delete form.

File

plugins/sweaver_plugin_images/sweaver_plugin_images.inc, line 357
Images plugin.

Class

sweaver_plugin_images
@file Images plugin.

Code

public function sweaver_get_image($fid) {
  if (!empty($fid)) {
    $query = 'SELECT ti.fid, ti.description, f.uri FROM {sweaver_image} ti
                INNER JOIN {file_managed} f on f.fid = ti.fid WHERE f.fid = :fid';
    $image = db_query($query, array(
      ':fid' => $fid,
    ))
      ->fetchObject();
    if (isset($image->fid)) {
      return $image;
    }
  }
  return FALSE;
}