regen thumbnail from cli

This commit is contained in:
Shish 2018-07-19 19:53:20 +01:00
parent 9b0edcf449
commit d91b0ec218

View File

@ -76,14 +76,26 @@ class AdminPage extends Extension {
public function onCommand(CommandEvent $event) {
if($event->cmd == "help") {
print " get-page [query string]\n";
print " eg 'get-page post/list'\n\n";
print "\tget-page [query string]\n";
print "\t\teg 'get-page post/list'\n\n";
print "\tregen-thumb [hash]\n";
print "\t\tregenerate a thumbnail\n\n";
}
if($event->cmd == "get-page") {
global $page;
send_event(new PageRequestEvent($event->args[0]));
$page->display();
}
if($event->cmd == "regen-thumb") {
$image = Image::by_hash($event->args[0]);
if($image) {
print("Regenerating thumb for image {$image->id} ({$image->hash})\n");
send_event(new ThumbnailGenerationEvent($image->hash, $image->ext, true));
}
else {
print("Can't find image with hash {$event->args[0]}\n");
}
}
}
public function onAdminBuilding(AdminBuildingEvent $event) {