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:
Alan Orth
2023-05-17 23:20:34 +03:00
parent 7dbfa9a3c5
commit a4105bdcb0
2 changed files with 3 additions and 3 deletions

View File

@@ -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);

View File

@@ -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();