imagecache.inc in Insert 6
Insert support for ImageCache module.
File
includes/imagecache.incView source
<?php
/**
* @file
* Insert support for ImageCache module.
*/
/**
* Implementation of hook_insert_styles().
*/
function imagecache_insert_styles() {
$presets = imagecache_presets();
$insert_styles = array();
foreach ($presets as $preset) {
$insert_styles['imagecache_' . $preset['presetname']] = array(
'label' => t($preset['presetname']),
);
}
return $insert_styles;
}
/**
* Implementation of hook_insert_content().
*/
function imagecache_insert_content($item, $style, $widget) {
$preset_name = preg_replace('/^imagecache_/', '', $style['name']);
return theme(array(
'imagecache_insert_image__' . str_replace('-', '_', $preset_name),
'imagecache_insert_image',
), $item, $widget, $preset_name);
}
/**
* Theme the content that will be inserted for ImageCache presets.
*/
function template_preprocess_imagecache_insert_image(&$vars) {
$absolute = isset($vars['widget']['insert_absolute']) ? $vars['widget']['insert_absolute'] : NULL;
$absolute = (bool) (isset($absolute) ? $absolute : variable_get('insert_absolute_paths', FALSE));
$vars['url'] = imagecache_create_url($vars['preset_name'], $vars['item']['filepath'], FALSE, $absolute);
$vars['class'] = !empty($vars['widget']['insert_class']) ? $vars['widget']['insert_class'] : '';
}
Functions
Name![]() |
Description |
---|---|
imagecache_insert_content | Implementation of hook_insert_content(). |
imagecache_insert_styles | Implementation of hook_insert_styles(). |
template_preprocess_imagecache_insert_image | Theme the content that will be inserted for ImageCache presets. |