hmm, use an image resource. Below code could probably get beautified a
bit.. And you might want to use shared resources if its something common..
form.add(new NonCachingImage("currentPicture",
new AbstractReadOnlyModel() {
@Override
public Object getObject() {
// TODO Auto-generated method stub
return new
ImageResource(getPerson().getPicture(),"png");
}
}));
package zeuzgroup.application.utils;
import java.awt.image.BufferedImage;
import org.apache.wicket.markup.html.image.resource.DynamicImageResource;
public class ImageResource extends DynamicImageResource {
// has to save this. or get the image another way!
private byte[] image;
public ImageResource(byte[] image, String format) {
this.image = image;
setFormat(format);
}
public ImageResource(BufferedImage image) {
this.image = toImageData(image);
}
@Override
protected byte[] getImageData() {
if (image != null) {
return image;
} else {
return new byte[0];
}
}
/**
* 1 day!
*/
@Override
protected int getCacheDuration() {
return 3600*24;
}
}
hinkel wrote:
Hi folks,
I am new to Wicket and have a simple questions to the experts:
I have images stored in a databse and want to display them on a webpage.
I've searched each and everything on the web but did not find a working
solution. It seems that the source of the much recommend cdapp-application
is not available anymore. I am using Wicket 1.3.4 and would appriciate a
link to some working example or any other hint how it is done.
Thank you for your help.
Greetings.
--
-Wicket for love
Nino Martinez Wael
Java Specialist @ Jayway DK
http://www.jayway.dk
+45 2936 7684
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]