cancel
Showing results for 
Search instead for 
Did you mean: 

Importing pictures to the image table with mdm java api

Former Member
0 Kudos

How to i import images into the Images table with the mdm java api? The images should not be stored as a blob in mdm, just a reference to the file system. How to i have to set the different fields of the ImagesBlobRecord.

i tried something like this:

final ImageBlobRecord record = RecordFactory.createEmptyImageRecord(imagesTableSchema.getTable().getId());

try {

final byte[] demoPicture = { 0x10, 0x10 };

record.setName(new StringValue("8400 Gruppe unten.tif"));

record.setOriginalName(new StringValue("8400 Gruppe unten.tif"));

record.setHasOriginal(new BooleanValue(false));

record.setDataLocationId(new GroupNodeId("

cde271489

d:

Document and Settings

Spilker

My Documents"));

record.setDataGroupId(new GroupNodeId(1));

record.setBinary(new BinaryValue(demoPicture));

record.setWidth(new IntegerValue(400));

record.setHeight(new IntegerValue(300));

record.setIsVector(new BooleanValue(false));

record.setFormat(null);

} catch (final IllegalArgumentException e) {

// TODO Auto-generated catch block

e.printStackTrace();

} catch (final MdmValueTypeException e) {

// TODO Auto-generated catch block

e.printStackTrace();

}

this gives an invalid ID format.

I´m also not sure about all the other fields where IDßs are required, which ID´s to use. Do i have to use third party libraries to get for example width and height of the pictures before using the setWidth and setHeight methods or are these values automatically filled during the import.

Some code snippet about how to use the various set functions would be really nice.

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Joerg,

I think that what you are trying to do (save a file location as a new image) via the API's is not possible.

Walter

Former Member
0 Kudos

I finally succeeded in importing an image with a file location. The problem is the DataLocationID you had to provide. This is a GroupNode and it´s a hierarchical structure. You had to split the filename into the path components and create nodes in the tree for every component.

Former Member
0 Kudos

Hi Joergspilker,

Can you please explain your solution in detail? Can you please explain how do i split the filename and create nodes?

Regards,

Sruti