You are here

public function sweaver_plugin_images::sweaver_images_handler in Sweaver 6

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

Images handler.

Overrides sweaver_plugin::sweaver_images_handler

File

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

Class

sweaver_plugin_images
@file Images plugin.

Code

public function sweaver_images_handler(&$images) {
  $imagecache_presets = array();
  if (variable_get('sweaver_plugin_images_imagecache', FALSE) && function_exists('imagecache_presets')) {
    $imagecache_presets = imagecache_presets();
  }
  $query = 'SELECT ti.fid, ti.description, f.filepath FROM {sweaver_image} ti
              INNER JOIN {files} f on f.fid = ti.fid order by description ASC';
  $result = db_query($query);
  while ($image = db_fetch_object($result)) {
    $images[$GLOBALS['base_url'] . '/' . $image->filepath] = $image->description;

    // Imagecache presets.
    foreach ($imagecache_presets as $preset_key => $preset) {
      $images[$GLOBALS['base_url'] . '/' . imagecache_create_url($preset['presetname'], $image->filepath)] = $image->description . ' (' . $preset['presetname'] . ')';
    }
  }
}