/** * Add a Thumbnailer-Class to the list of available Thumbnailers Note that the order you add * Thumbnailers may make a difference: First added Thumbnailers are tried first, if one fails, the * next (that claims to be able to treat such a document) is tried. (Thumbnailers that claim to * treat all MIME Types are tried last, though.) * * @param thumbnailer Thumbnailer to add. */ public void registerThumbnailer(Thumbnailer thumbnailer) { String[] acceptMIME = thumbnailer.getAcceptedMIMETypes(); if (acceptMIME == null) thumbnailers.put(ALL_MIME_WILDCARD, thumbnailer); else { for (String mime : acceptMIME) thumbnailers.put(mime, thumbnailer); } allThumbnailers.add(thumbnailer); thumbnailer.setImageSize(thumbWidth, thumbHeight, thumbOptions); }
/** * Set the image size of all following thumbnails. * * <p>ThumbnailManager delegates this to all his containing Thumbailers. */ public void setImageSize(int width, int height, int imageResizeOptions) { thumbHeight = height; thumbWidth = width; thumbOptions = imageResizeOptions; if (thumbWidth < 0) thumbWidth = 0; if (thumbHeight < 0) thumbHeight = 0; for (Thumbnailer thumbnailer : allThumbnailers) thumbnailer.setImageSize(thumbWidth, thumbHeight, thumbOptions); }