You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Hbiloo <wa...@gmail.com> on 2009/07/16 00:29:40 UTC
Help - Mounting a dynamic generated image
Hi everybody,
I've a list of thumbnail images that are dynamically generated from a byte
[] retrieved from the database. Each thumbnail links to the big image
variant of it.
My code:
...
@Override
protected void populateItem(final ListItem<MyImage> item) {
final int index = item.getIndex();
final MyImage mImage = item.getModelObject();
ResourceLink<ByteaImageResource> myImageLink =
newResourceLink<ByteaImageResource>(
"myImageLink",
new ByteaImageResource(myImage.getImage()));
myImageLink.add(new FancyBoxBehavior());
myImageLink.add(new ContextImage("ribbonImage", newModel<String>(
RIBBON_IMAGE)).setVisible(myImage.isMain()));
myImageLink.add(new Image("myImage",
newByteaImageResource(myImage.getImage())));
item.add(myImageLink);
}
...
public class ByteaImageResource extends DynamicImageResource {
private byte[] imageData;
public ByteaImageResource(byte[] imageData) {
this.imageData = imageData;
super.setLastModifiedTime(Time.now());
}
@Override
protected byte[] getImageData() {
return imageData;
}
}
This is how I would like the HTML to be generated:
...
<a href="images/image1.png" id="myImageLink1" wicket:id="myImageLink">
<img width="80" height="80" src="images/myImageBig1.png"
wicket:id="myImage"/>
</a>
<a href="images/image2.png" id="myImageLink2" wicket:id="myImageLink">
<img width="80" height="80" src="images/myImageBig2.png"
wicket:id="myImage"/>
</a>
...
How can I get these images as a mounted images and not as link such as:
http://localhost:8080/myApp/?wicket:interface=:0:sidebarPanels:1:sidebarPanel:contentContainer:myImages:1:myImageLink::IResourceListener
::
Kind Regards,
Hbiloo
Re: Help - Mounting a dynamic generated image
Posted by Igor Vaynberg <ig...@gmail.com>.
i believe there is a pickwick project somewhere in wicketstuff svn
that is an image gallery. you can have a look there for inspiration.
-igor
On Thu, Jul 16, 2009 at 2:55 AM, Hbiloo<wa...@gmail.com> wrote:
> Ooh, I forgot to say that I'm using these images to be displayed in a
> lightbox. This lightbox expects an image URL in it's href i.e
> "images/myImage.png".
> Someone already has the same issue?
>
> Kind Regards,
>
> Hbiloo
>
>
> On Thu, Jul 16, 2009 at 12:29 AM, Hbiloo <wa...@gmail.com> wrote:
>
>> Hi everybody,
>>
>> I've a list of thumbnail images that are dynamically generated from a byte
>> [] retrieved from the database. Each thumbnail links to the big image
>> variant of it.
>> My code:
>>
>> ...
>>
>> @Override
>>
>> protected void populateItem(final ListItem<MyImage> item) {
>>
>> final int index = item.getIndex();
>>
>> final MyImage mImage = item.getModelObject();
>>
>> ResourceLink<ByteaImageResource> myImageLink = newResourceLink<ByteaImageResource>(
>> "myImageLink",
>>
>> new ByteaImageResource(myImage.getImage()));
>>
>> myImageLink.add(new FancyBoxBehavior());
>>
>> myImageLink.add(new ContextImage("ribbonImage", newModel<String>(
>> RIBBON_IMAGE)).setVisible(myImage.isMain()));
>>
>> myImageLink.add(new Image("myImage", newByteaImageResource(myImage.getImage())));
>>
>> item.add(myImageLink);
>>
>> }
>>
>> ...
>>
>>
>> public class ByteaImageResource extends DynamicImageResource {
>>
>> private byte[] imageData;
>>
>>
>> public ByteaImageResource(byte[] imageData) {
>>
>> this.imageData = imageData;
>>
>> super.setLastModifiedTime(Time.now());
>>
>> }
>>
>>
>> @Override
>>
>> protected byte[] getImageData() {
>>
>> return imageData;
>>
>> }
>>
>> }
>>
>>
>> This is how I would like the HTML to be generated:
>> ...
>> <a href="images/image1.png" id="myImageLink1" wicket:id="myImageLink">
>>
>> <img width="80" height="80" src="images/myImageBig1.png"
>> wicket:id="myImage"/>
>> </a>
>> <a href="images/image2.png" id="myImageLink2" wicket:id="myImageLink">
>>
>> <img width="80" height="80" src="images/myImageBig2.png"
>> wicket:id="myImage"/>
>> </a>
>> ...
>>
>> How can I get these images as a mounted images and not as link such as:
>> http://localhost:8080/myApp/?wicket:interface=:0:sidebarPanels:1:sidebarPanel:contentContainer:myImages:1:myImageLink::IResourceListener
>> ::
>>
>> Kind Regards,
>>
>> Hbiloo
>>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: Help - Mounting a dynamic generated image
Posted by Hbiloo <wa...@gmail.com>.
Ooh, I forgot to say that I'm using these images to be displayed in a
lightbox. This lightbox expects an image URL in it's href i.e
"images/myImage.png".
Someone already has the same issue?
Kind Regards,
Hbiloo
On Thu, Jul 16, 2009 at 12:29 AM, Hbiloo <wa...@gmail.com> wrote:
> Hi everybody,
>
> I've a list of thumbnail images that are dynamically generated from a byte
> [] retrieved from the database. Each thumbnail links to the big image
> variant of it.
> My code:
>
> ...
>
> @Override
>
> protected void populateItem(final ListItem<MyImage> item) {
>
> final int index = item.getIndex();
>
> final MyImage mImage = item.getModelObject();
>
> ResourceLink<ByteaImageResource> myImageLink = newResourceLink<ByteaImageResource>(
> "myImageLink",
>
> new ByteaImageResource(myImage.getImage()));
>
> myImageLink.add(new FancyBoxBehavior());
>
> myImageLink.add(new ContextImage("ribbonImage", newModel<String>(
> RIBBON_IMAGE)).setVisible(myImage.isMain()));
>
> myImageLink.add(new Image("myImage", newByteaImageResource(myImage.getImage())));
>
> item.add(myImageLink);
>
> }
>
> ...
>
>
> public class ByteaImageResource extends DynamicImageResource {
>
> private byte[] imageData;
>
>
> public ByteaImageResource(byte[] imageData) {
>
> this.imageData = imageData;
>
> super.setLastModifiedTime(Time.now());
>
> }
>
>
> @Override
>
> protected byte[] getImageData() {
>
> return imageData;
>
> }
>
> }
>
>
> This is how I would like the HTML to be generated:
> ...
> <a href="images/image1.png" id="myImageLink1" wicket:id="myImageLink">
>
> <img width="80" height="80" src="images/myImageBig1.png"
> wicket:id="myImage"/>
> </a>
> <a href="images/image2.png" id="myImageLink2" wicket:id="myImageLink">
>
> <img width="80" height="80" src="images/myImageBig2.png"
> wicket:id="myImage"/>
> </a>
> ...
>
> How can I get these images as a mounted images and not as link such as:
> http://localhost:8080/myApp/?wicket:interface=:0:sidebarPanels:1:sidebarPanel:contentContainer:myImages:1:myImageLink::IResourceListener
> ::
>
> Kind Regards,
>
> Hbiloo
>