| 1 |
<?php |
<?php |
| 2 |
// $Id: imagecache_actions.inc,v 1.24.2.1 2009/08/19 18:29:29 drewish Exp $ |
// $Id: imagecache_actions.inc,v 1.24.2.2 2009/08/19 18:33:41 drewish Exp $ |
| 3 |
|
|
| 4 |
function imagecache_resize_form($action) { |
function imagecache_resize_form($action) { |
| 5 |
$form['width'] = array( |
$form['width'] = array( |
| 27 |
|
|
| 28 |
function theme_imagecache_resize($element) { |
function theme_imagecache_resize($element) { |
| 29 |
$data = $element['#value']; |
$data = $element['#value']; |
| 30 |
return 'width: '. $data['width'] .', height: '. $data['height']; |
if ($data['width'] && $data['height']) { |
| 31 |
|
return check_plain($data['width']) . 'x' . check_plain($data['height']); |
| 32 |
|
} |
| 33 |
|
return ($data['width']) ? t('width @width', array('@width' => $data['width'])) : t('height @height', array('@height' => $data['height'])); |
| 34 |
} |
} |
| 35 |
|
|
| 36 |
/** |
/** |
| 48 |
} |
} |
| 49 |
|
|
| 50 |
function theme_imagecache_scale($element) { |
function theme_imagecache_scale($element) { |
| 51 |
$output = theme_imagecache_resize($element) . ', upscale: '; |
return theme_imagecache_resize($element) . ' ' . ($element['#value']['upscale'] ? '(' . t('upscaling allowed') . ')' : ''); |
|
$output .= ($element['#value']['upscale']) ? t('Yes') : t('No'); |
|
|
return $output; |
|
| 52 |
} |
} |
| 53 |
|
|
| 54 |
function imagecache_scale_image(&$image, $data) { |
function imagecache_scale_image(&$image, $data) { |
| 120 |
|
|
| 121 |
function theme_imagecache_deprecated_scale($element) { |
function theme_imagecache_deprecated_scale($element) { |
| 122 |
$data = $element['#value']; |
$data = $element['#value']; |
| 123 |
$options = array('inside' => t('Inside dimensions'), 'outside' => t('Outside dimensions')); |
$fits = array('inside' => t('Inside dimensions'), 'outside' => t('Outside dimensions')); |
| 124 |
return 'width: '. $data['width'] .', height: '. $data['height'] .', fit: '. $options[$data['fit']]; |
return t('width: @width, height: @height, fit: @fit', array('@width' => $data['width'], '@height' => $data['height'], '@fit' => $fits[$data['fit']])); |
| 125 |
} |
} |
| 126 |
|
|
| 127 |
function imagecache_deprecated_scale_image(&$image, $data) { |
function imagecache_deprecated_scale_image(&$image, $data) { |
| 182 |
|
|
| 183 |
function theme_imagecache_crop($element) { |
function theme_imagecache_crop($element) { |
| 184 |
$data = $element['#value']; |
$data = $element['#value']; |
| 185 |
return 'width: '. $data['width'] .', height: '. $data['height'] .', xoffset: '. $data['xoffset'] .', yoffset: '. $data['yoffset']; |
return t('width: @width, height: @height, xoffset: @xoffset, yoffset: @yoffset', array( |
| 186 |
|
'@width' => $data['width'], |
| 187 |
|
'@height' => $data['height'], |
| 188 |
|
'@xoffset' => $data['xoffset'], |
| 189 |
|
'@yoffset' => $data['yoffset'], |
| 190 |
|
)); |
| 191 |
} |
} |
| 192 |
|
|
| 193 |
function imagecache_crop_image(&$image, $data) { |
function imagecache_crop_image(&$image, $data) { |
| 247 |
} |
} |
| 248 |
|
|
| 249 |
function theme_imagecache_rotate($element) { |
function theme_imagecache_rotate($element) { |
| 250 |
$output = t('degrees:') .' '. $element['#value']['degrees'] .', '; |
$data = $element['#value']; |
| 251 |
$output .= t('randomize:') .' '. (($element['#value']['random']) ? t('Yes') : t('No')) .', '; |
if ($data['random']) { |
| 252 |
$output .= t('background:') .' '. strlen(trim($element['#value']['bgcolor'])) ? $element['#value']['bgcolor'] : t('Transparent/white'); |
return t('random between -@degrees° and @degrees°', array('@degrees' => $data['degrees'])); |
| 253 |
return $output; |
} |
| 254 |
|
return t('@degrees°', array('@degrees' => $data['degrees'])); |
| 255 |
} |
} |
| 256 |
|
|
| 257 |
function imagecache_rotate_image(&$image, $data) { |
function imagecache_rotate_image(&$image, $data) { |
| 261 |
'random' => FALSE, |
'random' => FALSE, |
| 262 |
'bgcolor' => '', |
'bgcolor' => '', |
| 263 |
); |
); |
| 264 |
|
|
| 265 |
// Set sane default values. |
// Set sane default values. |
| 266 |
if (strlen(trim($data['bgcolor']))) { |
if (strlen(trim($data['bgcolor']))) { |
| 267 |
$data['bgcolor'] = hexdec(str_replace('#', '', $data['bgcolor'])); |
$data['bgcolor'] = hexdec(str_replace('#', '', $data['bgcolor'])); |
| 317 |
} |
} |
| 318 |
|
|
| 319 |
function theme_imagecache_sharpen($element) { |
function theme_imagecache_sharpen($element) { |
| 320 |
$output = t('radius:') .' '. $element['#value']['radius'] .', '; |
$data = $element['#value']; |
| 321 |
$output .= t('sigma:') .' '. $element['#value']['sigma'] .', '; |
return t('radius: @radius, sigma: @sigma, amount: @amount, threshold: @threshold', array( |
| 322 |
$output .= t('amount:') .' '. $element['#value']['amount'] .', '; |
'@radius' => $data['radius'], |
| 323 |
$output .= t('threshold:') .' '. $element['#value']['threshold'] ; |
'@sigma' => $data['sigma'], |
| 324 |
return $output; |
'@amount' => $data['amount'], |
| 325 |
|
'@threshold' => $data['threshold'], |
| 326 |
|
)); |
| 327 |
} |
} |
| 328 |
|
|
| 329 |
function imagecache_sharpen_image(&$image, $data) { |
function imagecache_sharpen_image(&$image, $data) { |