mirror of
https://github.com/DSpace/DSpace.git
synced 2025-10-07 01:54:22 +00:00
dspace-api: simplify logic in ImageMagickThumbnailFilter
There is no point passing a page parameter here, with a default of 0 no less, because we will *always* use the first page of the PDF to generate the thumbnail. No other filters use this function and the page parameter is not configurable so we should just hard code it.
This commit is contained in:
@@ -22,7 +22,7 @@ public class ImageMagickPdfThumbnailFilter extends ImageMagickThumbnailFilter {
|
||||
File f2 = null;
|
||||
File f3 = null;
|
||||
try {
|
||||
f2 = getImageFile(f, 0, verbose);
|
||||
f2 = getImageFile(f, verbose);
|
||||
f3 = getThumbnailFile(f2, verbose);
|
||||
byte[] bytes = Files.readAllBytes(f3.toPath());
|
||||
return new ByteArrayInputStream(bytes);
|
||||
|
@@ -116,7 +116,7 @@ public abstract class ImageMagickThumbnailFilter extends MediaFilter {
|
||||
return f2;
|
||||
}
|
||||
|
||||
public File getImageFile(File f, int page, boolean verbose)
|
||||
public File getImageFile(File f, boolean verbose)
|
||||
throws IOException, InterruptedException, IM4JavaException {
|
||||
File f2 = new File(f.getParentFile(), f.getName() + ".jpg");
|
||||
f2.deleteOnExit();
|
||||
@@ -155,7 +155,7 @@ public abstract class ImageMagickThumbnailFilter extends MediaFilter {
|
||||
op.define("pdf:use-cropbox=true");
|
||||
}
|
||||
|
||||
String s = "[" + page + "]";
|
||||
String s = "[0]";
|
||||
op.addImage(f.getAbsolutePath() + s);
|
||||
if (configurationService.getBooleanProperty(PRE + ".flatten", true)) {
|
||||
op.flatten();
|
||||
|
Reference in New Issue
Block a user