final byte[] locByte = new byte[1];
//We are in the case that image is not load (no byte Array) so isLoad is false
ImageInfo info = ensureFormatIsSupported(imageFile, locByte, false);
ContentTypeManager ctm = opcPackage.getContentTypeManager();
// Ensure the relationships part exists
if (sourcePart.getRelationshipsPart() == null) {
RelationshipsPart.createRelationshipsPartForPart(sourcePart);
}
String proposedRelId = sourcePart.getRelationshipsPart().getNextId();
String ext = info.getMimeType().substring(info.getMimeType().indexOf("/") + 1);
BinaryPartAbstractImage imagePart =
(BinaryPartAbstractImage) ctm.newPartForContentType(
info.getMimeType(),
createImageName(opcPackage, sourcePart, proposedRelId, ext), null);
log.debug("created part " + imagePart.getClass().getName()
+ " with name " + imagePart.getPartName().toString());