refactor
This commit is contained in:
		
							parent
							
								
									1532d5f390
								
							
						
					
					
						commit
						93c569c2cd
					
				
					 1 changed files with 3 additions and 3 deletions
				
			
		| 
						 | 
				
			
			@ -15,7 +15,7 @@ import isSvg from 'is-svg';
 | 
			
		|||
import probeImageSize from 'probe-image-size';
 | 
			
		||||
import { type predictionType } from 'nsfwjs';
 | 
			
		||||
import { sharpBmp } from '@misskey-dev/sharp-read-bmp';
 | 
			
		||||
import { encode } from 'blurhash';
 | 
			
		||||
import * as blurhash from 'blurhash';
 | 
			
		||||
import { createTempDir } from '@/misc/create-temp.js';
 | 
			
		||||
import { AiService } from '@/core/AiService.js';
 | 
			
		||||
import { LoggerService } from '@/core/LoggerService.js';
 | 
			
		||||
| 
						 | 
				
			
			@ -452,7 +452,7 @@ export class FileInfoService {
 | 
			
		|||
	}
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * Calculate average color of image
 | 
			
		||||
	 * Calculate blurhash string of image
 | 
			
		||||
	 */
 | 
			
		||||
	@bindThis
 | 
			
		||||
	private getBlurhash(path: string, type: string): Promise<string> {
 | 
			
		||||
| 
						 | 
				
			
			@ -467,7 +467,7 @@ export class FileInfoService {
 | 
			
		|||
					let hash;
 | 
			
		||||
 | 
			
		||||
					try {
 | 
			
		||||
						hash = encode(new Uint8ClampedArray(buffer), info.width, info.height, 5, 5);
 | 
			
		||||
						hash = blurhash.encode(new Uint8ClampedArray(buffer), info.width, info.height, 5, 5);
 | 
			
		||||
					} catch (e) {
 | 
			
		||||
						return reject(e);
 | 
			
		||||
					}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue