mirror of
				https://github.com/krateng/maloja.git
				synced 2023-08-10 21:12:55 +03:00 
			
		
		
		
	Moved to slightly smaller image library
This commit is contained in:
		| @@ -6,7 +6,7 @@ from threading import Thread | |||||||
| import setproctitle | import setproctitle | ||||||
| import pkg_resources | import pkg_resources | ||||||
| from css_html_js_minify import html_minify, css_minify | from css_html_js_minify import html_minify, css_minify | ||||||
| from wand.image import Image as WandImage | from pyvips import Image | ||||||
|  |  | ||||||
| # server stuff | # server stuff | ||||||
| from bottle import Bottle, static_file, request, response, FormsDict, redirect, BaseRequest, abort | from bottle import Bottle, static_file, request, response, FormsDict, redirect, BaseRequest, abort | ||||||
| @@ -175,16 +175,9 @@ def static_image(pth): | |||||||
| 		response = static_file(small_pth,root=data_dir['images']()) | 		response = static_file(small_pth,root=data_dir['images']()) | ||||||
| 	else: | 	else: | ||||||
| 		try: | 		try: | ||||||
| 			img = WandImage(filename=data_dir['images'](pth)) | 			thumb = Image.thumbnail(data_dir['images'](pth),300) | ||||||
| 			x,y = img.size[0], img.size[1] | 			thumb.webpsave(data_dir['images'](small_pth)) | ||||||
| 			smaller = min(x,y) | 			response = static_file(small_pth,root=data_dir['images']()) | ||||||
| 			if smaller > 300: |  | ||||||
| 				ratio = 300/smaller |  | ||||||
| 				img.resize(int(ratio*x),int(ratio*y)) |  | ||||||
| 				img.save(filename=data_dir['images'](small_pth)) |  | ||||||
| 				response = static_file(small_pth,root=data_dir['images']()) |  | ||||||
| 			else: |  | ||||||
| 				response = static_file(pth,root=data_dir['images']()) |  | ||||||
| 		except Exception: | 		except Exception: | ||||||
| 			response = static_file(pth,root=data_dir['images']()) | 			response = static_file(pth,root=data_dir['images']()) | ||||||
|  |  | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 krateng
					krateng