make convert.exe findable on windows
This commit is contained in:
		
							parent
							
								
									a086b9b7fc
								
							
						
					
					
						commit
						90a48abbec
					
				| @ -74,8 +74,25 @@ class PixelFileHandler extends DataHandlerExtension { | |||||||
| 		// convert to bitmap & back to strip metadata -- otherwise we
 | 		// convert to bitmap & back to strip metadata -- otherwise we
 | ||||||
| 		// can end up with 3KB of jpg data and 200KB of misc extra...
 | 		// can end up with 3KB of jpg data and 200KB of misc extra...
 | ||||||
| 		// "-limit memory $mem" broken?
 | 		// "-limit memory $mem" broken?
 | ||||||
| 		exec("convert {$inname}[0] -geometry {$w}x{$h} -strip -quality {$q} jpg:$outname"); | 
 | ||||||
| 		#exec("convert {$inname}[0] -geometry {$w}x{$h} bmp:- | convert bmp:- -quality {$q} jpg:$outname");
 | 		// Windows is a special case, use what will work on most everything else first
 | ||||||
|  | 		if(in_array("OS", $_SERVER) && $_SERVER["OS"] != 'Windows_NT') { | ||||||
|  | 			$cmd = "convert {$inname}[0] -strip -thumbnail {$w}x{$h} jpg:$outname"; | ||||||
|  | 		} | ||||||
|  | 		else { | ||||||
|  | 			$imageMagick = $config->get_string("thumb_convert_path"); | ||||||
|  | 
 | ||||||
|  | 			// running the call with cmd.exe requires quoting for our paths
 | ||||||
|  | 			$stringFormat = '"%s" "%s[0]" -strip -thumbnail %ux%u jpg:"%s"'; | ||||||
|  | 
 | ||||||
|  | 			// Concat the command altogether
 | ||||||
|  | 			$cmd = sprintf($stringFormat, $imageMagick, $inname, $w, $h, $outname); | ||||||
|  | 		} | ||||||
|  | 
 | ||||||
|  | 		// Execute IM's convert command, grab the output and return code it'll help debug it
 | ||||||
|  | 		exec($cmd, $output, $ret); | ||||||
|  | 
 | ||||||
|  | 		log_debug('handle_pixel', "Generating thumnail with command `$cmd`, returns $ret"); | ||||||
| 
 | 
 | ||||||
| 		return true; | 		return true; | ||||||
| 	} | 	} | ||||||
|  | |||||||
| @ -95,6 +95,7 @@ class ImageIO extends SimpleExtension { | |||||||
| 		$config->set_default_int('thumb_height', 192); | 		$config->set_default_int('thumb_height', 192); | ||||||
| 		$config->set_default_int('thumb_quality', 75); | 		$config->set_default_int('thumb_quality', 75); | ||||||
| 		$config->set_default_int('thumb_mem_limit', parse_shorthand_int('8MB')); | 		$config->set_default_int('thumb_mem_limit', parse_shorthand_int('8MB')); | ||||||
|  | 		$config->set_default_string('thumb_convert_path', 'convert.exe'); | ||||||
| 
 | 
 | ||||||
| 		$config->set_default_bool('image_show_meta', false); | 		$config->set_default_bool('image_show_meta', false); | ||||||
| 		$config->set_default_string('image_ilink', ''); | 		$config->set_default_string('image_ilink', ''); | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user