mirror of
				https://github.com/flynx/ImageGrid.git
				synced 2025-10-31 03:10:07 +00:00 
			
		
		
		
	added export mode UI (not fully working yet) + some cleanup and minor tweaks...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
		
							parent
							
								
									d4ca5ba455
								
							
						
					
					
						commit
						1849e63b63
					
				| @ -2082,23 +2082,14 @@ var FileSystemWriterActions = actions.Actions({ | |||||||
| 	// XXX handle .image.path and other stack files...
 | 	// XXX handle .image.path and other stack files...
 | ||||||
| 	// XXX local collections???
 | 	// XXX local collections???
 | ||||||
| 	//
 | 	//
 | ||||||
|  | 	// XXX ASAP test settings['export-mode'] = 'copy best match'
 | ||||||
| 	// XXX BUG: max_size is measured by preview size and ignores main 
 | 	// XXX BUG: max_size is measured by preview size and ignores main 
 | ||||||
| 	// 		image size...
 | 	// 		image size...
 | ||||||
| 	// 		...this results in exported images being previews ONLY IF 
 | 	// 		...this results in exported images being previews ONLY IF 
 | ||||||
| 	// 		they have previews larger than max_size...
 | 	// 		they have previews larger than max_size...
 | ||||||
| 	// XXX BUG: this does not remove previews correctly...
 |  | ||||||
| 	// 		to reproduce:
 |  | ||||||
| 	// 			open: L:\media\img\my\2019
 |  | ||||||
| 	// 			exportIndex: with max_size=400
 |  | ||||||
| 	// 				-> main preview is not replaced
 |  | ||||||
| 	// 				-> preivew size 350px not copied but kept in index...
 |  | ||||||
| 	// 		temporary workaround:
 |  | ||||||
| 	//			ig.getPreviews('*')
 |  | ||||||
| 	//				.then(function(){
 |  | ||||||
| 	//					ig.markChanged('images')
 |  | ||||||
| 	//					console.log('done.') })
 |  | ||||||
| 	// XXX when no previews present this should create at least one file
 | 	// XXX when no previews present this should create at least one file
 | ||||||
| 	// 		of max_size...
 | 	// 		of max_size...
 | ||||||
|  | 	// XXX might also be good to save/load the export options to .ImageGrid-export.json
 | ||||||
| 	// XXX log gid count instead of file count...
 | 	// XXX log gid count instead of file count...
 | ||||||
| 	exportIndex: ['- File/Export/Export index', | 	exportIndex: ['- File/Export/Export index', | ||||||
| 		core.doc` | 		core.doc` | ||||||
| @ -2106,6 +2097,10 @@ var FileSystemWriterActions = actions.Actions({ | |||||||
| 			.exportIndex(path) | 			.exportIndex(path) | ||||||
| 			.exportIndex(settings) | 			.exportIndex(settings) | ||||||
| 
 | 
 | ||||||
|  | 		settings format: | ||||||
|  | 			{ | ||||||
|  | 			} | ||||||
|  | 
 | ||||||
| 		`,
 | 		`,
 | ||||||
| 		function(path, max_size, include_orig, clean_target_dir, logger){ | 		function(path, max_size, include_orig, clean_target_dir, logger){ | ||||||
| 			var that = this | 			var that = this | ||||||
| @ -2130,10 +2125,9 @@ var FileSystemWriterActions = actions.Actions({ | |||||||
| 				|| null | 				|| null | ||||||
| 			// XXX make this dependant on max_size....
 | 			// XXX make this dependant on max_size....
 | ||||||
| 			include_orig = include_orig || true | 			include_orig = include_orig || true | ||||||
| 
 |  | ||||||
| 			// XXX get value from settings...
 |  | ||||||
| 			var resize = max_size  | 			var resize = max_size  | ||||||
| 				&& this.makeResizedImage | 				&& this.makeResizedImage | ||||||
|  | 				&& settings['export-mode'] != 'copy best match' | ||||||
| 
 | 
 | ||||||
| 			// clear/backup target...
 | 			// clear/backup target...
 | ||||||
| 			clean_target_dir = clean_target_dir === undefined ?  | 			clean_target_dir = clean_target_dir === undefined ?  | ||||||
| @ -2358,17 +2352,14 @@ var FileSystemWriterActions = actions.Actions({ | |||||||
| 
 | 
 | ||||||
| 			return Promise.all(queue) }], | 			return Promise.all(queue) }], | ||||||
| 
 | 
 | ||||||
| 	// XXX ASAP add option to control copy/resize -> .makeResizedImage(..)...
 | 	// XXX ASAP test settings['export-mode'] = 'copy best match'
 | ||||||
| 	// XXX might also be good to save/load the export options to .ImageGrid-export.json
 | 	// XXX might also be good to save/load the export options to .ImageGrid-export.json
 | ||||||
| 	// XXX resolve env variables in path... (???)
 | 	// XXX resolve env variables in path... (???)
 | ||||||
| 	// XXX make custom previews (option)...
 | 	// XXX make custom previews (option)...
 | ||||||
| 	// 		...should this be a function of .images.getBestPreview(..)???
 |  | ||||||
| 	// XXX report errors...
 | 	// XXX report errors...
 | ||||||
| 	// XXX stop the process on errors...
 | 	// XXX stop the process on errors...
 | ||||||
| 	// XXX use tasks...
 | 	// XXX use tasks...
 | ||||||
| 	// XXX check global index ('%I') in crop...
 | 	// XXX check global index ('%I') in crop...
 | ||||||
| 	// XXX add option to "clean" destination...
 |  | ||||||
| 	// 		...i.e. if destination exists then move it to .removed/<date>/
 |  | ||||||
| 	// XXX make clean_target more error tolerant...
 | 	// XXX make clean_target more error tolerant...
 | ||||||
| 	exportDirs: ['- File/Export/Export ribbons as directories', | 	exportDirs: ['- File/Export/Export ribbons as directories', | ||||||
| 		core.doc`Export ribbons as directories
 | 		core.doc`Export ribbons as directories
 | ||||||
| @ -2418,6 +2409,9 @@ var FileSystemWriterActions = actions.Actions({ | |||||||
| 			size = size  | 			size = size  | ||||||
| 				|| settings['preview-size']  | 				|| settings['preview-size']  | ||||||
| 				|| 1000 | 				|| 1000 | ||||||
|  | 			// XXX needs testing...
 | ||||||
|  | 			var resize = this.makeResizedImage | ||||||
|  | 				&& settings['export-mode'] != 'copy best match' | ||||||
| 			pattern = pattern  | 			pattern = pattern  | ||||||
| 				|| settings['preview-name-pattern']  | 				|| settings['preview-name-pattern']  | ||||||
| 				|| EXPORT_PREVIEW_NAME | 				|| EXPORT_PREVIEW_NAME | ||||||
| @ -2601,6 +2595,7 @@ var FileSystemWriterUIActions = actions.Actions({ | |||||||
| 					// 		this is set...
 | 					// 		this is set...
 | ||||||
| 					// XXX need to add option to save full index...
 | 					// XXX need to add option to save full index...
 | ||||||
| 					'size_limit', | 					'size_limit', | ||||||
|  | 					'export_mode', | ||||||
| 					// XXX might be a good idea to include source data links
 | 					// XXX might be a good idea to include source data links
 | ||||||
| 					//'include_source_url', // bool
 | 					//'include_source_url', // bool
 | ||||||
| 					'comment', | 					'comment', | ||||||
| @ -2613,12 +2608,11 @@ var FileSystemWriterUIActions = actions.Actions({ | |||||||
| 					//'name',
 | 					//'name',
 | ||||||
| 					'pattern', | 					'pattern', | ||||||
| 					'size', | 					'size', | ||||||
|  | 					'export_mode', | ||||||
| 					'include_virtual', | 					'include_virtual', | ||||||
| 					'base_path', | 					'base_path', | ||||||
| 					'target_dir', | 					'target_dir', | ||||||
| 					'clean_target_dir', | 					'clean_target_dir', | ||||||
| 					// XXX add option to disable this...
 |  | ||||||
| 					//'level_dir',
 |  | ||||||
| 				], | 				], | ||||||
| 			}, | 			}, | ||||||
| 		}, | 		}, | ||||||
| @ -3002,6 +2996,21 @@ var FileSystemWriterUIActions = actions.Actions({ | |||||||
| 						!settings['include-virtual']  | 						!settings['include-virtual']  | ||||||
| 					elem.find('.text').last() | 					elem.find('.text').last() | ||||||
| 						.text(v ? 'yes' : 'no') }, }) }, | 						.text(v ? 'yes' : 'no') }, }) }, | ||||||
|  | 		'export_mode': function(actions, make, parent, settings){ | ||||||
|  | 			if(!actions.makeResizedImage){ | ||||||
|  | 				return } | ||||||
|  | 			settings['export-mode'] =  | ||||||
|  | 				settings['export-mode']  | ||||||
|  | 				|| 'resize' | ||||||
|  | 			var elem = make(['Export $mode: ', settings['export-mode'] ],  | ||||||
|  | 				{ open: function(){ | ||||||
|  | 					var v = settings['export-mode'] =  | ||||||
|  | 						settings['export-mode'] == 'resize' ? | ||||||
|  | 							'copy best match' | ||||||
|  | 							: 'resize' | ||||||
|  | 					elem.find('.text') | ||||||
|  | 						.last() | ||||||
|  | 							.text(v) }, }) }, | ||||||
| 		'clean_target_dir': function(actions, make, parent, settings){ | 		'clean_target_dir': function(actions, make, parent, settings){ | ||||||
| 			settings['clean-target'] = !!settings['clean-target'] | 			settings['clean-target'] = !!settings['clean-target'] | ||||||
| 			var elem = make([ | 			var elem = make([ | ||||||
|  | |||||||
| @ -119,10 +119,8 @@ var SharpActions = actions.Actions({ | |||||||
| 			this.previewConstructorWorker && this.previewConstructorWorker.kill() | 			this.previewConstructorWorker && this.previewConstructorWorker.kill() | ||||||
| 			delete this.previewConstructorWorker }], | 			delete this.previewConstructorWorker }], | ||||||
| 
 | 
 | ||||||
| 	// XXX Q: if skipSmaller and overwrite: 'backup' and image smaller (skiped) do we backup???
 |  | ||||||
| 	// 		...I think no...
 |  | ||||||
| 	// XXX make backup name pattern configurable...
 | 	// XXX make backup name pattern configurable...
 | ||||||
| 	// XXX add transform/crop support...
 | 	// XXX add crop support...
 | ||||||
| 	// XXX revise logging...
 | 	// XXX revise logging...
 | ||||||
| 	makeResizedImage: ['- Image/', | 	makeResizedImage: ['- Image/', | ||||||
| 		core.doc`Make resized image(s)...
 | 		core.doc`Make resized image(s)...
 | ||||||
| @ -329,7 +327,6 @@ var SharpActions = actions.Actions({ | |||||||
| 										 | 										 | ||||||
| 	// XXX use .makeResizedImage(..)
 | 	// XXX use .makeResizedImage(..)
 | ||||||
| 	// XXX should this account for non-jpeg images???
 | 	// XXX should this account for non-jpeg images???
 | ||||||
| 	// XXX BUG?: this breaks on PNG images...
 |  | ||||||
| 	// XXX log: count gids and not specific images...
 | 	// XXX log: count gids and not specific images...
 | ||||||
| 	makePreviews: ['Sharp|File/Make image $previews', | 	makePreviews: ['Sharp|File/Make image $previews', | ||||||
| 		core.doc`Make image previews
 | 		core.doc`Make image previews
 | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user