mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-31 17:39:05 +00:00
REPO-5235: Use unforked tika (#1081)
* REPO-5235: Use latst unforked tika version from the updated alfresco-data-model * Recognise new Exif properties and use a previous workaround to set correct tiff:ImageLength and tiff:ImageWidth
This commit is contained in:
4
pom.xml
4
pom.xml
@@ -36,7 +36,7 @@
|
|||||||
|
|
||||||
<maven.build.sourceVersion>11</maven.build.sourceVersion>
|
<maven.build.sourceVersion>11</maven.build.sourceVersion>
|
||||||
|
|
||||||
<dependency.alfresco-data-model.version>8.132</dependency.alfresco-data-model.version>
|
<dependency.alfresco-data-model.version>8.134</dependency.alfresco-data-model.version>
|
||||||
<dependency.alfresco-core.version>8.36</dependency.alfresco-core.version>
|
<dependency.alfresco-core.version>8.36</dependency.alfresco-core.version>
|
||||||
|
|
||||||
<dependency.alfresco-legacy-lucene.version>6.2</dependency.alfresco-legacy-lucene.version>
|
<dependency.alfresco-legacy-lucene.version>6.2</dependency.alfresco-legacy-lucene.version>
|
||||||
@@ -50,7 +50,7 @@
|
|||||||
<dependency.spring-security.version>5.2.1.RELEASE</dependency.spring-security.version>
|
<dependency.spring-security.version>5.2.1.RELEASE</dependency.spring-security.version>
|
||||||
<dependency.httpcomponents.version>4.5.10</dependency.httpcomponents.version>
|
<dependency.httpcomponents.version>4.5.10</dependency.httpcomponents.version>
|
||||||
<dependency.truezip.version>7.7.10</dependency.truezip.version>
|
<dependency.truezip.version>7.7.10</dependency.truezip.version>
|
||||||
<dependency.poi.version>4.1.1</dependency.poi.version>
|
<dependency.poi.version>4.1.2</dependency.poi.version>
|
||||||
<dependency.ooxml-schemas.version>1.4</dependency.ooxml-schemas.version>
|
<dependency.ooxml-schemas.version>1.4</dependency.ooxml-schemas.version>
|
||||||
<dependency.webscripts.version>8.4</dependency.webscripts.version>
|
<dependency.webscripts.version>8.4</dependency.webscripts.version>
|
||||||
<dependency.opencmis.version>1.0.0</dependency.opencmis.version>
|
<dependency.opencmis.version>1.0.0</dependency.opencmis.version>
|
||||||
|
@@ -68,11 +68,10 @@ public class TikaAutoMetadataExtracter extends TikaPoweredMetadataExtracter
|
|||||||
protected static Log logger = LogFactory.getLog(TikaAutoMetadataExtracter.class);
|
protected static Log logger = LogFactory.getLog(TikaAutoMetadataExtracter.class);
|
||||||
private static AutoDetectParser parser;
|
private static AutoDetectParser parser;
|
||||||
private static TikaConfig config;
|
private static TikaConfig config;
|
||||||
private static String EXIF_IMAGE_HEIGHT_TAG = "Exif Image Height";
|
private static String EXIF_IMAGE_HEIGHT_TAG = "Exif SubIFD:Exif Image Height";
|
||||||
private static String EXIF_IMAGE_WIDTH_TAG = "Exif Image Width";
|
private static String EXIF_IMAGE_WIDTH_TAG = "Exif SubIFD:Exif Image Width";
|
||||||
private static String JPEG_IMAGE_HEIGHT_TAG = "Image Height";
|
private static String JPEG_IMAGE_HEIGHT_TAG = "Image Height";
|
||||||
private static String JPEG_IMAGE_WIDTH_TAG = "Image Width";
|
private static String JPEG_IMAGE_WIDTH_TAG = "Image Width";
|
||||||
private static String COMPRESSION_TAG = "Compression";
|
|
||||||
|
|
||||||
public static ArrayList<String> SUPPORTED_MIMETYPES;
|
public static ArrayList<String> SUPPORTED_MIMETYPES;
|
||||||
private static ArrayList<String> buildMimeTypes(TikaConfig tikaConfig)
|
private static ArrayList<String> buildMimeTypes(TikaConfig tikaConfig)
|
||||||
@@ -122,24 +121,19 @@ public class TikaAutoMetadataExtracter extends TikaPoweredMetadataExtracter
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
protected Map<String, Serializable> extractSpecific(Metadata metadata,
|
protected Map<String, Serializable> extractSpecific(Metadata metadata,
|
||||||
Map<String, Serializable> properties, Map<String,String> headers)
|
Map<String, Serializable> properties, Map<String, String> headers)
|
||||||
{
|
{
|
||||||
if(MimetypeMap.MIMETYPE_IMAGE_JPEG.equals(metadata.get(Metadata.CONTENT_TYPE)))
|
if (MimetypeMap.MIMETYPE_IMAGE_JPEG.equals(metadata.get(Metadata.CONTENT_TYPE)))
|
||||||
{
|
{
|
||||||
//check if the image has exif information
|
//check if the image has exif information
|
||||||
if(metadata.get(EXIF_IMAGE_WIDTH_TAG) != null
|
if (metadata.get(EXIF_IMAGE_WIDTH_TAG) != null && metadata.get(EXIF_IMAGE_HEIGHT_TAG) != null)
|
||||||
&& metadata.get(EXIF_IMAGE_HEIGHT_TAG) != null
|
|
||||||
&& metadata.get(COMPRESSION_TAG) != null)
|
|
||||||
{
|
{
|
||||||
//replace the exif size properties that will be embedded in the node with
|
//replace the exif size properties that will be embedded in the node with
|
||||||
//the guessed dimensions from Tika
|
//the guessed dimensions from Tika
|
||||||
putRawValue(TIFF.IMAGE_LENGTH.getName(), extractSize(metadata.get(EXIF_IMAGE_HEIGHT_TAG)), properties);
|
putRawValue(TIFF.IMAGE_LENGTH.getName(), extractSize(metadata.get(JPEG_IMAGE_HEIGHT_TAG)), properties);
|
||||||
putRawValue(TIFF.IMAGE_WIDTH.getName(), extractSize(metadata.get(EXIF_IMAGE_WIDTH_TAG)), properties);
|
putRawValue(TIFF.IMAGE_WIDTH.getName(), extractSize(metadata.get(JPEG_IMAGE_WIDTH_TAG)), properties);
|
||||||
putRawValue(JPEG_IMAGE_HEIGHT_TAG, metadata.get(EXIF_IMAGE_HEIGHT_TAG), properties);
|
|
||||||
putRawValue(JPEG_IMAGE_WIDTH_TAG, metadata.get(EXIF_IMAGE_WIDTH_TAG), properties);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return properties;
|
return properties;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user