1
votes

I'm using a Java Agent to scale an uploaded image and then put it into the local DB Image Resources to allow developers to use that resource in their forms (my DB will be an image manager for developers).

Basically, it works in the webbrowser buit not in the View or Designer. When I import the Image Resource with the DXLImporter- class, the Designer tells me the image size is 0x0 pixels.

But it isn't! When I check out the image withing Images, I can see the preview. The strange thing about this is: When I export the (agent)- imported image, delete the Image Resource and then import it, it works.

The code to import an Image Resource:

//Prepare the DXL import
            DxlImporter dxlImport = session.createDxlImporter(); 
            dxlImport.setAclImportOption(DxlImporter.DXLIMPORTOPTION_UPDATE_ELSE_CREATE);
            dxlImport.setDesignImportOption(DxlImporter.DXLIMPORTOPTION_REPLACE_ELSE_CREATE);

            //Init the manager - sets the DXL
            DxlManager dxlManager = new DxlManager(buffer, strName, strAlias, extension, session.getServerName() + "!!" + db.getFilePath(), db.getReplicaID());

            //Actual import the DXL
            dxlImport.importDxl(dxlManager.BuildDxlFromTemplate(session), db);

BuildDxlFromTemplate creates a DXL layout from a template and simply replaces the needed fields (name, alias, jpeg, size, mimetype)

If I compare the agent imported resource with a manually important resource, the only difference is the missing Signature field. A manual sign doesn't help though.

This is a modified DXL:

<?xml version='1.0'?>
<!DOCTYPE imageresource SYSTEM 'xmlschemas/domino_8_5_3.dtd'>
<imageresource name='24-7-32.png' alias='static/24-7-32.png' xmlns='http://www.lotus.com/dxl' version='8.5'
 maintenanceversion='3.6' replicaid='[REPLICATIONID]' publicaccess='false'
 designerversion='8.5.3'>
<jpeg
>iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAACRUlEQVR42u1XzUsbURD3A6wgqGD1ErEHD4oQSQ+iRy39D4Te7bWgIigecxKEgif1DygoBLyLiCePAb0EEkJICWkSQr42u/naZDf9DezC8Ny0m83GXDIQQmbevPnNm9/MexkZGcpQHEgwGJypVCrXrVarqOt6m0TTNLlWq93kcjlP3wJLkrSJoEq1Wj2JxWJLZvBIJOKB7gg2uW2ILMvfXA2uKMqt3+8f4zoEvULmda5D7FFVVYMEAoAKrgQPh8MrVvpoNPoBmf6wsuXz+TUCgVPSB8aVeDw+afCjMTAQREoCgXJdDAwEuuMXgeh5I8qizaRUKn0R7OeGaVf0NU7h2FYgsLdkBuF6sPsVrbiRSqU+ivZQKDTBsL0BAN9HW1zAwheeZSeWg9waB4DNqxhOZ50AJBKJZVtlaAuCjRVxTTab/Uy2crl8Sr8Bch/rNOa/22nvrgGITsVi0Ue6er3+QL8DgcC4Ud8tfK0aoPdpRjBuHEBXcwSADxJkum0E+8nWL1iBxvBaNwDvoKy/rZL5LwBkednN6bhSAgS9NzcHqb5zG2q+J35Ef9Kh7z+JeioVdYKd8TlrAmg2m0m3hhHdoODFtK3FKLtqgshkMlNuAEAyku3FuMkWOQ97DY629dGg6soJ9Xpis6BJ97xTABjZXx05IrDKGc+fW3igHNKDI5lMzv1rD7ycvD0dnwgCXfJMY5frAERKp9PzfbtOxfvBSgDiT1/v9EKh4DUfoVaC3r9+l8cF1bzRaNyhDDrLPjv8szIUp/IXl04kE/VVVrcAAAAASUVORK5CYII=</jpeg>
<item name='$FileSize' sign='true'><number>638</number></item>
<item name='$MimeType' sign='true'><text>image/png</text></item>
<item name='$FileModDT' sign='true'><datetime dst='true'>20150401T100408,08+02</datetime></item></imageresource>

I'm using the 9.0.1 PF2 Client/Designer with a 8.5.3 Server (yes, that's horrible).

Help is appreciated :)

1

1 Answers

0
votes

Alright, after a week of trying and losing all hope, it turns out that a proper .png Import is not possible with Client 9.0.1 or Server 8.5.3.

Importing jpeg, jpg and gif works like a charm. pngs however, do have trouble.

The problem is well known and a fix is "on the way".