File tree Expand file tree Collapse file tree 1 file changed +16
-3
lines changed
src/backend/model/fileprocessing Expand file tree Collapse file tree 1 file changed +16
-3
lines changed Original file line number Diff line number Diff line change @@ -100,6 +100,7 @@ export class PhotoProcessing {
100100 } ,
101101 useLanczos3 : Config . Media . Thumbnail . useLanczos3 ,
102102 quality : Config . Media . Thumbnail . quality ,
103+ smartSubsample : Config . Media . Thumbnail . smartSubsample ,
103104 } as RendererInput ;
104105 input . cut . width = Math . min (
105106 input . cut . width ,
@@ -149,6 +150,10 @@ export class PhotoProcessing {
149150 ) ;
150151 }
151152
153+ /**
154+ * Tells if the path is valid with the current config
155+ * @param convertedPath
156+ */
152157 public static async isValidConvertedPath (
153158 convertedPath : string
154159 ) : Promise < boolean > {
@@ -179,16 +184,24 @@ export class PhotoProcessing {
179184 return false ;
180185 }
181186
182- const qualityStr = convertedPath . substring (
187+
188+ let qualityStr = convertedPath . substring (
183189 convertedPath . lastIndexOf ( 'q' ) + 1 ,
184190 convertedPath . length - path . extname ( convertedPath ) . length
185191 ) ;
186192
193+
194+ if ( Config . Media . Thumbnail . smartSubsample ) {
195+ if ( ! qualityStr . endsWith ( 'cs' ) ) { // remove chromatic subsampling flag if exists
196+ return false ;
197+ }
198+ qualityStr = qualityStr . slice ( 0 , - 2 ) ;
199+ }
200+
187201 const quality = parseInt ( qualityStr , 10 ) ;
188202
189203 if ( ( quality + '' ) . length !== qualityStr . length ||
190- quality < 0 ||
191- quality > 100 ) {
204+ quality !== Config . Media . Thumbnail . quality ) {
192205 return false ;
193206 }
194207
You can’t perform that action at this time.
0 commit comments