commit | author | age
|
e369b9
|
1 |
/* |
c45b52
|
2 |
fm - File management class library |
e369b9
|
3 |
Copyright (C) 2024 Ulrich Hilger |
U |
4 |
|
|
5 |
This program is free software: you can redistribute it and/or modify |
|
6 |
it under the terms of the GNU Affero General Public License as |
|
7 |
published by the Free Software Foundation, either version 3 of the |
|
8 |
License, or (at your option) any later version. |
|
9 |
|
|
10 |
This program is distributed in the hope that it will be useful, |
|
11 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
13 |
GNU Affero General Public License for more details. |
|
14 |
|
|
15 |
You should have received a copy of the GNU Affero General Public License |
|
16 |
along with this program. If not, see <https://www.gnu.org/licenses/>. |
|
17 |
*/ |
|
18 |
package de.uhilger.fm; |
|
19 |
|
|
20 |
import java.io.File; |
|
21 |
import java.io.FileFilter; |
|
22 |
|
|
23 |
/** |
|
24 |
* Ein Filter zum Auslassen kleiner Versionen einer Original-Bilddatei |
|
25 |
* |
|
26 |
* @author Ulrich Hilger |
|
27 |
* @version 1, 12. Mai 2021 |
|
28 |
*/ |
|
29 |
public class ImageFileFilter implements FileFilter { |
973951
|
30 |
|
U |
31 |
public static final String JPG = ".jpg"; |
|
32 |
public static final String JPEG = ".jpeg"; |
|
33 |
public static final String PNG = ".png"; |
|
34 |
|
|
35 |
public static final String B64 = "_b64"; // Base64-Encoded |
|
36 |
|
|
37 |
public static final String TN = "_tn"; // 120 |
|
38 |
public static final String KL = "_kl"; // 240 |
|
39 |
public static final String SM = "_sm"; // 500 |
|
40 |
public static final String MT = "_mt"; // 700 |
|
41 |
public static final String GR = "_gr"; // 1200 |
|
42 |
|
e369b9
|
43 |
@Override |
U |
44 |
public boolean accept(File pathname) { |
|
45 |
boolean pass = true; |
|
46 |
String fname = pathname.getName().toLowerCase(); |
973951
|
47 |
if(fname.endsWith(JPEG) || |
U |
48 |
fname.endsWith(JPG) || fname.endsWith(PNG)) { |
|
49 |
if(fname.contains(GR) || fname.contains(KL) || |
|
50 |
fname.contains(MT) || fname.contains(SM) || |
|
51 |
fname.contains(TN) || fname.contains(B64)) { |
e369b9
|
52 |
pass = false; |
U |
53 |
} |
|
54 |
} |
|
55 |
return pass; |
|
56 |
} |
|
57 |
} |
|
58 |
|