more warehouse_path use
This commit is contained in:
		
							parent
							
								
									181bbcc9b7
								
							
						
					
					
						commit
						3df4c712fa
					
				@ -7,9 +7,8 @@
 | 
			
		||||
 | 
			
		||||
class FlashFileHandler extends DataHandlerExtension {
 | 
			
		||||
	protected function create_thumb($hash) {
 | 
			
		||||
		$ha = substr($hash, 0, 2);
 | 
			
		||||
		// FIXME: scale image, as not all boards use 192x192
 | 
			
		||||
		copy("ext/handle_flash/thumb.jpg", "thumbs/$ha/$hash");
 | 
			
		||||
		copy("ext/handle_flash/thumb.jpg", warehouse_path("thumbs", $hash));
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	protected function supported_ext($ext) {
 | 
			
		||||
 | 
			
		||||
@ -91,9 +91,8 @@ class IcoFileHandler extends SimpleExtension {
 | 
			
		||||
	private function create_thumb($hash) {
 | 
			
		||||
		global $config;
 | 
			
		||||
 | 
			
		||||
		$ha = substr($hash, 0, 2);
 | 
			
		||||
		$inname  = "images/$ha/$hash";
 | 
			
		||||
		$outname = "thumbs/$ha/$hash";
 | 
			
		||||
		$inname  = warehouse_path("images", $hash);
 | 
			
		||||
		$outname = warehouse_path("thumbs", $hash);
 | 
			
		||||
 | 
			
		||||
		$w = $config->get_int("thumb_width");
 | 
			
		||||
		$h = $config->get_int("thumb_height");
 | 
			
		||||
 | 
			
		||||
@ -7,9 +7,8 @@
 | 
			
		||||
 | 
			
		||||
class MP3FileHandler extends DataHandlerExtension {
 | 
			
		||||
	protected function create_thumb($hash) {
 | 
			
		||||
		$ha = substr($hash, 0, 2);
 | 
			
		||||
		// FIXME: scale image, as not all boards use 192x192
 | 
			
		||||
		copy("ext/handle_mp3/thumb.jpg", "thumbs/$ha/$hash");
 | 
			
		||||
		copy("ext/handle_mp3/thumb.jpg", warehouse_path("thumbs", $hash));
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	protected function supported_ext($ext) {
 | 
			
		||||
 | 
			
		||||
@ -16,7 +16,7 @@ class SVGFileHandler implements Extension {
 | 
			
		||||
			$ha = substr($hash, 0, 2);
 | 
			
		||||
			if(!move_upload_to_archive($event)) return;
 | 
			
		||||
			send_event(new ThumbnailGenerationEvent($event->hash, $event->type));
 | 
			
		||||
			$image = $this->create_image_from_data("images/$ha/$hash", $event->metadata);
 | 
			
		||||
			$image = $this->create_image_from_data(warehouse_path("images", $hash), $event->metadata);
 | 
			
		||||
			if(is_null($image)) {
 | 
			
		||||
				throw new UploadException("SVG handler failed to create image object from data");
 | 
			
		||||
			}
 | 
			
		||||
@ -41,7 +41,7 @@ class SVGFileHandler implements Extension {
 | 
			
		||||
//			}
 | 
			
		||||
//			else {
 | 
			
		||||
				// FIXME: scale image, as not all boards use 192x192
 | 
			
		||||
				copy("ext/handle_svg/thumb.jpg", "thumbs/$ha/$hash");
 | 
			
		||||
				copy("ext/handle_svg/thumb.jpg", warehouse_path("thumbs", $hash));
 | 
			
		||||
//			}
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
@ -55,11 +55,10 @@ class SVGFileHandler implements Extension {
 | 
			
		||||
			$id = int_escape($event->get_arg(0));
 | 
			
		||||
			$image = Image::by_id($id);
 | 
			
		||||
			$hash = $image->hash;
 | 
			
		||||
			$ha = substr($hash, 0, 2);
 | 
			
		||||
 | 
			
		||||
			$page->set_type("image/svg+xml");
 | 
			
		||||
			$page->set_mode("data");
 | 
			
		||||
			$page->set_data(file_get_contents("images/$ha/$hash"));
 | 
			
		||||
			$page->set_data(file_get_contents(warehouse_path("images", $hash)));
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -43,8 +43,8 @@ class PixelFileHandler extends DataHandlerExtension {
 | 
			
		||||
 | 
			
		||||
	protected function create_thumb($hash) {
 | 
			
		||||
		$ha = substr($hash, 0, 2);
 | 
			
		||||
		$inname  = "images/$ha/$hash";
 | 
			
		||||
		$outname = "thumbs/$ha/$hash";
 | 
			
		||||
		$inname  = warehouse_path("images", $hash);
 | 
			
		||||
		$outname = warehouse_path("thumbs", $hash);
 | 
			
		||||
		global $config;
 | 
			
		||||
 | 
			
		||||
		$ok = false;
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user