regen thumbnail from cli
This commit is contained in:
		
							parent
							
								
									9b0edcf449
								
							
						
					
					
						commit
						d91b0ec218
					
				| @ -76,14 +76,26 @@ class AdminPage extends Extension { | |||||||
| 
 | 
 | ||||||
| 	public function onCommand(CommandEvent $event) { | 	public function onCommand(CommandEvent $event) { | ||||||
| 		if($event->cmd == "help") { | 		if($event->cmd == "help") { | ||||||
| 			print "  get-page [query string]\n"; | 			print "\tget-page [query string]\n"; | ||||||
| 			print "    eg 'get-page post/list'\n\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") { | 		if($event->cmd == "get-page") { | ||||||
| 			global $page; | 			global $page; | ||||||
| 			send_event(new PageRequestEvent($event->args[0])); | 			send_event(new PageRequestEvent($event->args[0])); | ||||||
| 			$page->display(); | 			$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) { | 	public function onAdminBuilding(AdminBuildingEvent $event) { | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user