change min thumbnail size
This commit is contained in:
parent
34808d856a
commit
51347a606a
3 changed files with 32 additions and 30 deletions
|
@ -749,10 +749,10 @@ public interface FessConfig extends FessEnv, org.codelibs.fess.mylasta.direction
|
|||
/** The key of the configuration. e.g. png */
|
||||
String THUMBNAIL_HTML_PHANTOMJS_FORMAT = "thumbnail.html.phantomjs.format";
|
||||
|
||||
/** The key of the configuration. e.g. 50 */
|
||||
/** The key of the configuration. e.g. 100 */
|
||||
String THUMBNAIL_HTML_IMAGE_MIN_WIDTH = "thumbnail.html.image.min.width";
|
||||
|
||||
/** The key of the configuration. e.g. 50 */
|
||||
/** The key of the configuration. e.g. 100 */
|
||||
String THUMBNAIL_HTML_IMAGE_MIN_HEIGHT = "thumbnail.html.image.min.height";
|
||||
|
||||
/** The key of the configuration. e.g. 3.0 */
|
||||
|
@ -3674,14 +3674,14 @@ public interface FessConfig extends FessEnv, org.codelibs.fess.mylasta.direction
|
|||
|
||||
/**
|
||||
* Get the value for the key 'thumbnail.html.image.min.width'. <br>
|
||||
* The value is, e.g. 50 <br>
|
||||
* The value is, e.g. 100 <br>
|
||||
* @return The value of found property. (NotNull: if not found, exception but basically no way)
|
||||
*/
|
||||
String getThumbnailHtmlImageMinWidth();
|
||||
|
||||
/**
|
||||
* Get the value for the key 'thumbnail.html.image.min.width' as {@link Integer}. <br>
|
||||
* The value is, e.g. 50 <br>
|
||||
* The value is, e.g. 100 <br>
|
||||
* @return The value of found property. (NotNull: if not found, exception but basically no way)
|
||||
* @throws NumberFormatException When the property is not integer.
|
||||
*/
|
||||
|
@ -3689,14 +3689,14 @@ public interface FessConfig extends FessEnv, org.codelibs.fess.mylasta.direction
|
|||
|
||||
/**
|
||||
* Get the value for the key 'thumbnail.html.image.min.height'. <br>
|
||||
* The value is, e.g. 50 <br>
|
||||
* The value is, e.g. 100 <br>
|
||||
* @return The value of found property. (NotNull: if not found, exception but basically no way)
|
||||
*/
|
||||
String getThumbnailHtmlImageMinHeight();
|
||||
|
||||
/**
|
||||
* Get the value for the key 'thumbnail.html.image.min.height' as {@link Integer}. <br>
|
||||
* The value is, e.g. 50 <br>
|
||||
* The value is, e.g. 100 <br>
|
||||
* @return The value of found property. (NotNull: if not found, exception but basically no way)
|
||||
* @throws NumberFormatException When the property is not integer.
|
||||
*/
|
||||
|
|
|
@ -78,29 +78,31 @@ public class HtmlTagBasedGenerator extends BaseThumbnailGenerator {
|
|||
return false;
|
||||
}
|
||||
|
||||
Curl.get(url).execute(con -> {
|
||||
boolean created = false;
|
||||
try (ImageInputStream input = ImageIO.createImageInputStream(con.getInputStream())) {
|
||||
if (saveImage(input, outputFile)) {
|
||||
created = true;
|
||||
} else {
|
||||
logger.warn("Failed to create a thumbnail for " + url);
|
||||
}
|
||||
} catch (final Throwable t) {
|
||||
if (logger.isDebugEnabled()) {
|
||||
logger.warn("Failed to create a thumbnail for " + url, t);
|
||||
} else {
|
||||
logger.warn("Failed to create a thumbnail for " + url + " " + t.getClass() + ": " + t.getMessage());
|
||||
}
|
||||
} finally {
|
||||
if (!created) {
|
||||
updateThumbnailField(thumbnailId, url, StringUtil.EMPTY);
|
||||
if (outputFile.exists() && !outputFile.delete()) {
|
||||
logger.warn("Failed to delete " + outputFile.getAbsolutePath());
|
||||
Curl.get(url).execute(
|
||||
con -> {
|
||||
boolean created = false;
|
||||
try (ImageInputStream input = ImageIO.createImageInputStream(con.getInputStream())) {
|
||||
if (saveImage(input, outputFile)) {
|
||||
created = true;
|
||||
} else {
|
||||
logger.warn("Failed to create thumbnail: " + url);
|
||||
}
|
||||
} catch (final Throwable t) {
|
||||
if (logger.isDebugEnabled()) {
|
||||
logger.warn("Failed to create thumbnail: " + url, t);
|
||||
} else {
|
||||
logger.warn("Failed to create thumbnail: " + url + " (" + t.getClass().getCanonicalName() + ": "
|
||||
+ t.getMessage() + ")");
|
||||
}
|
||||
} finally {
|
||||
if (!created) {
|
||||
updateThumbnailField(thumbnailId, url, StringUtil.EMPTY);
|
||||
if (outputFile.exists() && !outputFile.delete()) {
|
||||
logger.warn("Failed to delete " + outputFile.getAbsolutePath());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
return outputFile.exists();
|
||||
}
|
||||
|
|
|
@ -388,8 +388,8 @@ thumbnail.html.phantomjs.window.height=800
|
|||
thumbnail.html.phantomjs.thumbnail.width=100
|
||||
thumbnail.html.phantomjs.thumbnail.height=100
|
||||
thumbnail.html.phantomjs.format=png
|
||||
thumbnail.html.image.min.width=50
|
||||
thumbnail.html.image.min.height=50
|
||||
thumbnail.html.image.min.width=100
|
||||
thumbnail.html.image.min.height=100
|
||||
thumbnail.html.image.max.aspect.ratio=3.0
|
||||
thumbnail.html.image.window.width=1200
|
||||
thumbnail.html.image.window.height=800
|
||||
|
|
Loading…
Add table
Reference in a new issue