$image, '%data' => print_r($data, true))), WATCHDOG_ERROR); return false; } return true; } function imagecache_resize_form($action) { $form['width'] = array( '#type' => 'textfield', '#title' => t('Width'), '#default_value' => $action['width'], '#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' => $action['height'], '#description' => t('Enter a height in pixels or as a percentage. i.e. 500 or 80%.'), ); return $form; } function theme_imagecache_resize($element) { $data = $element['#value']; if ($data['width'] && $data['height']) { return check_plain($data['width']) . 'x' . check_plain($data['height']); } return ($data['width']) ? t('width @width', array('@width' => $data['width'])) : t('height @height', array('@height' => $data['height'])); } /** * Imagecache Scale */ function imagecache_scale_form($data) { $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) { return theme_imagecache_resize($element) . ' ' . ($element['#value']['upscale'] ? '(' . t('upscaling allowed') . ')' : ''); } 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', t('imagecache_scale_image failed. image: %image, data: %data.', array('%path' => $image, '%data' => print_r($data, true))), WATCHDOG_ERROR); return false; } return true; } /** * Imagecache Scale and Crop */ function imagecache_scale_and_crop_form($data) { 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', t('imagecache_scale_and_crop failed. image: %image, data: %data.', array('%path' => $image, '%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) { $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 = '