From c065e3814555f9ad7204d0f9ec4f5081bce9ed20 Mon Sep 17 00:00:00 2001 From: Daku Date: Sun, 16 Feb 2014 04:38:58 +0000 Subject: [PATCH] adds widget/thumb option to random_thumb ext (for #323) this code was suggested in the comments, but never actually added --- ext/random_image/main.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/ext/random_image/main.php b/ext/random_image/main.php index ced59d67..0d799855 100644 --- a/ext/random_image/main.php +++ b/ext/random_image/main.php @@ -45,11 +45,18 @@ class RandomImage extends Extension { $page->set_data(file_get_contents($image->get_image_filename())); } } - if($action === "view") { + else if($action === "view") { if(!is_null($image)) { send_event(new DisplayingImageEvent($image, $page)); } } + else if($action === "widget") { + if(!is_null($image)) { + $page->set_mode("data"); + $page->set_type("text/html"); + $page->set_data($this->theme->build_thumb_html($image)); + } + } } }