public function sweaver_plugin_images::sweaver_images_handler in Sweaver 7
Same name and namespace in other branches
- 6 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 125 - Images plugin.
Class
- sweaver_plugin_images
- @file Images plugin.
Code
public function sweaver_images_handler(&$images) {
$styles = array();
if (variable_get('sweaver_plugin_images_styles', FALSE) && function_exists('image_styles')) {
$styles = image_styles();
}
$query = 'SELECT ti.fid, ti.description, f.uri FROM {sweaver_image} ti
INNER JOIN {file_managed} f on f.fid = ti.fid order by description ASC';
$images_result = db_query($query)
->fetchAll();
global $base_root;
foreach ($images_result as $image) {
$images[str_replace($base_root, '', file_create_url($image->uri))] = $image->description;
// Styles presets.
foreach ($styles as $preset_key => $preset) {
$images[image_style_url($preset_key, $image->uri)] = $image->description . ' (' . $preset['name'] . ')';
}
}
}