This repository has been archived on 2024-09-05. You can view files and clone it, but cannot push or open issues or pull requests.
shimmie2/contrib/regen_thumb/main.php

34 lines
1,011 B
PHP
Raw Normal View History

<?php
2009-08-20 22:37:17 +00:00
/*
* Name: Regen Thumb
* Author: Shish <webmaster@shishnet.org>
* License: GPLv2
* Description: Regenerate a thumbnail image
2009-01-16 08:18:41 +00:00
* Documentation:
* This adds a button in the image control section on an
* image's view page, which allows an admin to regenerate
* an image's thumbnail; useful for instance if the first
* attempt failed due to lack of memory, and memory has
* since been increased.
*/
2009-07-01 23:52:24 +00:00
class RegenThumb extends SimpleExtension {
public function onPageRequest($event) {
2009-07-01 23:46:22 +00:00
global $config, $database, $page, $user;
2009-07-01 23:52:24 +00:00
if($event->page_matches("regen_thumb") && $user->is_admin() && isset($_POST['image_id'])) {
$image = Image::by_id(int_escape($_POST['image_id']));
send_event(new ThumbnailGenerationEvent($image->hash, $image->ext, true));
2009-07-01 23:52:24 +00:00
$this->theme->display_results($page, $image);
}
2009-07-01 23:52:24 +00:00
}
2009-07-01 23:52:24 +00:00
public function onImageAdminBlockBuilding($event) {
global $user;
if($user->is_admin()) {
$event->add_part($this->theme->get_buttons_html($event->image->id));
}
}
}
?>