Index: imagecache_ui.module =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/imagecache/imagecache_ui.module,v retrieving revision 1.11.2.1 diff -u -p -r1.11.2.1 imagecache_ui.module --- imagecache_ui.module 6 Jan 2009 03:31:15 -0000 1.11.2.1 +++ imagecache_ui.module 18 Mar 2009 09:27:36 -0000 @@ -352,6 +352,25 @@ function imagecache_ui_preset_form($pres '#type' => 'submit', '#value' => t('Update Preset'), ); + + // Display a preview image for this action. Put it below the submit button so + // users don't have to do a bunch of scrolling. + $preview_path = file_create_path('imagecache_sample.png'); + if (!file_exists($preview_path)) { + // Copy of the image into the files directory so rather than generating it + // from the original so we don't end up creating subdirectories mirroring + // the path to the this module. + $preview_path = drupal_get_path('module', 'imagecache_ui') .'/sample.png'; + file_copy($preview_path, 'imagecache_sample.png'); + } + imagecache_image_flush($preview_path); + $imagecache_path = imagecache_create_url($preset['presetname'], $preview_path) .'?'. time(); + $form['preview'] = array( + '#type' => 'item', + '#title' => t('Preview'), + '#value' => l($imagecache_path, $imagecache_path) .'
'. l("", $imagecache_path, array(), NULL, NULL, FALSE, TRUE), + ); + return $form; }