when a particular art index is not found, try a lower one

This commit is contained in:
myk
2013-03-09 18:07:31 +00:00
parent a0e6d9ecb6
commit 8ec8803b11
2 changed files with 8 additions and 11 deletions

View File

@@ -67,10 +67,6 @@ public class ImageCache {
return scaleImage(ii.getImageFilename(), width, height); return scaleImage(ii.getImageFilename(), width, height);
} }
public static BufferedImage getImage(final String key, final int width, final int height) {
return scaleImage(key, width, height);
}
private static BufferedImage scaleImage(String key, final int width, final int height) { private static BufferedImage scaleImage(String key, final int width, final int height) {
if (3 > width || 3 > height) { if (3 > width || 3 > height) {
// picture too small; return a blank // picture too small; return a blank

View File

@@ -19,7 +19,7 @@ final class ImageLoader extends CacheLoader<String, BufferedImage> {
@Override @Override
public BufferedImage load(String key) { public BufferedImage load(String key) {
final String path; final String path;
String filename; final String filename;
if (key.startsWith(ImageCache.TOKEN_PREFIX)) { if (key.startsWith(ImageCache.TOKEN_PREFIX)) {
filename = key.substring(ImageCache.TOKEN_PREFIX.length()); filename = key.substring(ImageCache.TOKEN_PREFIX.length());
path = NewConstants.CACHE_TOKEN_PICS_DIR; path = NewConstants.CACHE_TOKEN_PICS_DIR;
@@ -48,15 +48,16 @@ final class ImageLoader extends CacheLoader<String, BufferedImage> {
} }
// try without set prefix // try without set prefix
String setlessFilename = null;
if (null == ret && filename.contains("/")) { if (null == ret && filename.contains("/")) {
filename = filename.substring(filename.indexOf('/') + 1); setlessFilename = filename.substring(filename.indexOf('/') + 1);
ret = _findFile(key, path, filename); ret = _findFile(key, path, setlessFilename);
} }
// // try lowering the art index to 0 for regular cards // try lowering the art index to the minimum for regular cards
// if (null == ret && filename.contains(".full.")) { if (null == ret && null != setlessFilename && setlessFilename.contains(".full")) {
// ret = _findFile(key, path, filename.substring(filename.indexOf('/') + 1)); ret = _findFile(key, path, setlessFilename.replaceAll("[0-9]*[.]full", "1.full"));
// } }
if (null == ret) { if (null == ret) {
System.out.println("File not found, no image created: " + key); System.out.println("File not found, no image created: " + key);