Hi

http://wicketinaction.com/2011/07/wicket-1-5-mounting-resources/ is exactly
what you need.
At the bottom of the article there is a link to a demo application. Check
its sources


On Wed, Dec 19, 2012 at 2:43 PM, Arun Chauhan <arundraj...@gmail.com> wrote:

> I have a repository storing many images somewhere on the server.
> I want to be able to create a dynamic Image object with one of the images
> stored in my repository.
>
> I am using wicket 1.5.7. I saw this example somewhere
>
> 1) Created the FileResource class:
>
>     public class FileResource extends WebResource {
>     private static final long serialVersionUID = 1L;
>
>     private File file;
>
>     public FileResource(File file) {
>         this.file = file;
>     }
>
>     @Override
>     public IResourceStream getResourceStream() {
>         return new FileResourceStream(file);
>     }
>     }
>
>
> 2) In MyPage.java:
>
>     File imageFile = new File("local_path_to_image");
>     Image myImage = new Image("myImage", new FileResource(imageFile));
>     add(myImage);
>
> 3) In MyPage.html:
>
>     <i-m-g wicket:id="myImage" />
>
> But this is not working in my case because WebResource is not available in
> my wicket 1.5.
>
> I have also studied this
> [link](http://wicketinaction.com/2011/07/wicket-1-5-mounting-resources/)
> in
> wicket action. But I am a wicket bignner i could not understand much.
>
> I am making a project in which user when click on a product a modal window
> open with the product name. I also want to include the product image on my
> modal window inside a modal window. Images are stored on my server in a
> directory.
>
> Any help and advices appreciated! Thanks in advance.
>
>
>
>
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/Wicket-create-image-from-file-system-outside-web-application-directory-tp4654932.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>


-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com <http://jweekend.com/>

Reply via email to