summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--imagecache_ui.module19
-rw-r--r--sample.pngbin0 -> 25329 bytes
2 files changed, 19 insertions, 0 deletions
diff --git a/imagecache_ui.module b/imagecache_ui.module
index 7fdf57d..d13b214 100644
--- a/imagecache_ui.module
+++ b/imagecache_ui.module
@@ -352,6 +352,25 @@ function imagecache_ui_preset_form($presetid) {
'#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) .'<br />'. l("<img src='$imagecache_path' />", $imagecache_path, array(), NULL, NULL, FALSE, TRUE),
+ );
+
return $form;
}
diff --git a/sample.png b/sample.png
new file mode 100644
index 0000000..f8ced55
--- /dev/null
+++ b/sample.png
Binary files differ