commit
40c3861bc9
@ -18,7 +18,7 @@ class RegenThumb extends SimpleExtension {
|
|||||||
|
|
||||||
if($event->page_matches("regen_thumb") && $user->is_admin() && isset($_POST['image_id'])) {
|
if($event->page_matches("regen_thumb") && $user->is_admin() && isset($_POST['image_id'])) {
|
||||||
$image = Image::by_id(int_escape($_POST['image_id']));
|
$image = Image::by_id(int_escape($_POST['image_id']));
|
||||||
send_event(new ThumbnailGenerationEvent($image->hash, $image->ext));
|
send_event(new ThumbnailGenerationEvent($image->hash, $image->ext, true));
|
||||||
$this->theme->display_results($page, $image);
|
$this->theme->display_results($page, $image);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -194,7 +194,12 @@ abstract class DataHandlerExtension implements Extension {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(($event instanceof ThumbnailGenerationEvent) && $this->supported_ext($event->type)) {
|
if(($event instanceof ThumbnailGenerationEvent) && $this->supported_ext($event->type)) {
|
||||||
$this->create_thumb($event->hash);
|
if (method_exists($this, 'create_thumb_force') && $event->force == true) {
|
||||||
|
$this->create_thumb_force($event->hash);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$this->create_thumb($event->hash);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(($event instanceof DisplayingImageEvent) && $this->supported_ext($event->image->ext)) {
|
if(($event instanceof DisplayingImageEvent) && $this->supported_ext($event->image->ext)) {
|
||||||
|
@ -48,6 +48,14 @@ class PixelFileHandler extends DataHandlerExtension {
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected function create_thumb($hash) {
|
protected function create_thumb($hash) {
|
||||||
|
$outname = warehouse_path("thumbs", $hash);
|
||||||
|
if(file_exists($outname)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return $this->create_thumb_force($hash);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function create_thumb_force($hash) {
|
||||||
$inname = warehouse_path("images", $hash);
|
$inname = warehouse_path("images", $hash);
|
||||||
$outname = warehouse_path("thumbs", $hash);
|
$outname = warehouse_path("thumbs", $hash);
|
||||||
global $config;
|
global $config;
|
||||||
|
@ -89,17 +89,18 @@ class ImageReplaceException extends SCoreException {
|
|||||||
* Request a thumbnail be made for an image object.
|
* Request a thumbnail be made for an image object.
|
||||||
*/
|
*/
|
||||||
class ThumbnailGenerationEvent extends Event {
|
class ThumbnailGenerationEvent extends Event {
|
||||||
var $hash, $type;
|
var $hash, $type, $force;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Request a thumbnail be made for an image object
|
* Request a thumbnail be made for an image object
|
||||||
*
|
*
|
||||||
* @param $hash The unique hash of the image
|
* @param $hash The unique hash of the image
|
||||||
* @param $type The type of the image
|
* @param $type The type of the image
|
||||||
*/
|
*/
|
||||||
public function ThumbnailGenerationEvent($hash, $type) {
|
public function ThumbnailGenerationEvent($hash, $type, $force=false) {
|
||||||
$this->hash = $hash;
|
$this->hash = $hash;
|
||||||
$this->type = $type;
|
$this->type = $type;
|
||||||
|
$this->force = $force;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user