View Full Version : Image rendering help

13 May 2009, 12:51 AM
Hello everyone,

I'm working on a university project using JEE+GXT. My goal is to develop something like an image-viewer and -editor. The concept is quite simple: users can register, make albums, upload images into them, edit the images (rotate, scale, flip, sharpen, etc.).
I thought why not try to store the images as longBlobs in the database, as i don't have to worry about performance now.(and this way, i don't have to do the fileoperations) So i made my Image entitybean with a byte array field like this:

@Lob @Basic(fetch=FetchType.LAZY)
@Column(columnDefinition="LONGBLOB NOT NULL")
protected byte[] imageData;

I have the business-layer methods to get the image entities to the web-layer. Next i tried to use the imageorganizer sample from http://extjs.com/explorer/#imageorganizer to display these images, but i cant see how to insert my imageData into the listview. Is it even possible? I dont quite understand the sample either, where does the actual image data come from? Does this Photo class contain a path field or something which is automatically processed?

Sorry if my questions are lame, i'm quite new to gxt. Also i tried google, with no success.
Please provide me some directions.


13 May 2009, 1:47 AM
Ok, i noticed now that the getTemplate() is the method that binds the object's fields to html. So can i put the binary data into the html somehow? (unfortunately I guess its not possible :s). Then i have to do a servlet that returns the appropriate image for a given url, right?

13 May 2009, 1:51 AM
Yes, you have to use a servlet that serves up the image. Some browsers (FF3 and IE8) support data urls. There you dont need that.

31 Aug 2010, 12:37 PM
Did you ever succeed in creating your GXT image viewer?