Java not commit image

0
Hi, i wanna play with some image processing The API docs says: storeImageDocumentContent(IContext, IMendixObject, InputStream, int, int) - Method in class com.mendix.core.component.InternalCore Physically stores an image using the given input stream and commits the image document. I want to create the image but not commit it, that guy commits it. // BEGIN USER CODE Core.getLogger(this.toString()).info("start"); IContext context=getContext(); try { // get input stream InputStream is = Core.getImage(getContext(), this.__img, false); BufferedImage original = ImageIO.read(is); // process image ColorConvertOp op = new ColorConvertOp(ColorSpace.getInstance(ColorSpace.CS_GRAY), null); op.filter(original, original); //save to output stream String formatName = this.getFormatName( Core.getImage(getContext(), this.__img, false) ); Core.getLogger(this.toString()).info("Format: "+ formatName); ByteArrayOutputStream os = new ByteArrayOutputStream(); ImageIO.write(original, formatName, os); InputStream stream = new ByteArrayInputStream(os.toByteArray()); //write to output object //IMendixObject retval=new myImage(context).getMendixObject(); IMendixObject retval= Core.instantiate(getContext(), myImage.entityName.toString()); //Core.storeImageDocumentContent(getContext(), retval, stream, 32,32); return retval; } catch (Exception e) { Core.getLogger(this.toString()).error(e); } Core.getLogger(this.toString()).info("end"); IMendixObject retval=new myImage(context).getMendixObject(); return null;//retval; // END USER CODE Thx (and sorry, i'm still stupid with the javas)
asked
1 answers
1

I believe that FileDocument entities (and specializations such as Image) must be committed in order to be accessible to the UI. This is because the file data is stored on the filesystem, and therefore must have a committed database object to refer to it.

Why don't you want to commit the processed image?

answered