'textfield', '#title' => t('Width'), '#default_value' => isset($action['width']) ? $action['width'] : '100%', '#description' => t('Enter a width in pixels or as a percentage. i.e. 500 or 80%.'), ); $form['height'] = array( '#type' => 'textfield', '#title' => t('Height'), '#default_value' => isset($action['height']) ? $action['height'] : '100%', '#description' => t('Enter a height in pixels or as a percentage. i.e. 500 or 80%.'), ); return $form; } function imagecache_resize_image(&$image, $data) { if (!imageapi_image_resize($image, $data['width'], $data['height'])) { watchdog('imagecache', 'imagecache_resize_image failed. image: %image, data: %data.', array('%path' => $image, '%data' => print_r($data, TRUE)), WATCHDOG_ERROR); return FALSE; } return TRUE; } function theme_imagecache_resize($element) { $data = $element['#value']; return 'width: '. $data['width'] .', height: '. $data['height']; } /** * ImageCache Scale */ function imagecache_scale_form($data = array()) { $form = imagecache_resize_form($data); $form['upscale'] = array( '#type' => 'checkbox', '#default_value' => (isset($data['upscale'])) ? $data['upscale'] : 0, '#title' => t('Allow Upscaling'), '#description' => t('Let scale make images larger than their original size'), ); return $form; } function theme_imagecache_scale($element) { $output = theme_imagecache_resize($element) . ', upscale: '; $output .= ($element['#value']['upscale']) ? t('Yes') : t('No'); return $output; } function imagecache_scale_image(&$image, $data) { // Set impossibly large values if the width and height aren't set. $data['width'] = $data['width'] ? $data['width'] : 9999999; $data['height'] = $data['height'] ? $data['height'] : 9999999; if (!imageapi_image_scale($image, $data['width'], $data['height'], $data['upscale'])) { watchdog('imagecache', 'imagecache_scale_image failed. image: %image, data: %data.', array('%image' => $image->source, '%data' => print_r($data, TRUE)), WATCHDOG_ERROR); return FALSE; } return TRUE; } /** * ImageCache Scale and Crop */ function imagecache_scale_and_crop_form($data = array()) { return imagecache_resize_form($data); } function theme_imagecache_scale_and_crop($element) { return theme_imagecache_resize($element); } function imagecache_scale_and_crop_image(&$image, $data) { if (!imageapi_image_scale_and_crop($image, $data['width'], $data['height'])) { watchdog('imagecache', 'imagecache_scale_and_crop failed. image: %image, data: %data.', array('%image' => $image->source, '%data' => print_r($data, TRUE)), WATCHDOG_ERROR); return FALSE; } return TRUE; } /** * ImageCache Deprecated Scale. * This will be removed in imagecache 2.1 */ function imagecache_deprecated_scale_form($data = array()) { $helptext = array(); $helptext['inside'] = t('Inside dimensions: Final dimensions will be less than or equal to the entered width and height. Useful for ensuring a maximum height and/or width.'); $helptext['outside'] = t('Outside dimensions: Final dimensions will be greater than or equal to the entered width and height. Ideal for cropping the result to a square.'); $description = '