I don't think you can just use the file path ( and that is not secure... )

Please read the following to understand how to use resource reference
on external images:
https://cwiki.apache.org/WICKET/how-to-load-an-external-image.html


Žilvinas Vilutis

Mobile:   (+370) 652 38353
E-mail:   cika...@gmail.com



2010/12/13 Ladislav DANKO <em...@1ac0.net>:
> Snippet of code (note relevant removed):
> //file list in folder, sorted
> Folder folder = ((Start)Application.get()).getUploadFolder();
> File[] files = folder.getFiles();
> List<File> lList = Arrays.asList(files);
> Collections.sort(lList);
> //for every image create clickable link with image as link
> RepeatingView view = new RepeatingView("repeater");
> Iterator<File> iterator = lList.iterator();
> while(iterator.hasNext())
> {
>        iterator.next();
>        String fileName = lList.get(i).getName();
>        String path = "photo/" + fileName;
>        String compID = view.newChildId();
>        PhotoRepeater clickableImg = new PhotoRepeater(compID);
>        clickableImg.add(new ExternalLink("photoPath", path).add(new
> Image("image", path)));
>        view.add(clickableImg);
> }
> this.add(view);
>
> In the final I have right path for "img src" and wrong path in "a href"
>
> Laco
>
>> -----Original Message-----
>> From: Zilvinas Vilutis [mailto:cika...@gmail.com]
>> Sent: Monday, December 13, 2010 8:11 AM
>> To: users@wicket.apache.org
>> Subject: Re: resource for href="...
>>
>> I don't see where your "path" is constructed. Did you want to
>> construct an url for an Image ResourceReference ?
>>
>>
>> Žilvinas Vilutis
>>
>> Mobile:   (+370) 652 38353
>> E-mail:   cika...@gmail.com
>>
>>
>>
>> 2010/12/13 Ladislav DANKO <em...@1ac0.net>:
>> > No, I don't need to download it, what I need is right path in href
>> > attribute in anchor html tag as is in img html tag (created
>> as new Image).
>> >
>> >
>> >> -----Original Message-----
>> >> From: jcar...@carmanconsulting.com
>> >> [mailto:jcar...@carmanconsulting.com] On Behalf Of James Carman
>> >> Sent: Monday, December 13, 2010 12:13 AM
>> >> To: users@wicket.apache.org
>> >> Subject: Re: resource for href="...
>> >>
>> >> You want it to download the image?  Try DownloadLink.
>> >>
>> >> On Sun, Dec 12, 2010 at 6:02 PM, Ladislav DANKO <em...@1ac0.net>
>> >> wrote:
>> >> > Hi guys,
>> >> >
>> >> > another question -have code (PhotoRepeater extends Panel, view is
>> >> > RepeatingView):
>> >> > ...
>> >> > String compID = view.newChildId();
>> >> > PhotoRepeater clickableImg = new PhotoRepeater(compID);
>> >> > clickableImg.add(new ExternalLink("fotoPath", path).add(new
>> >> > Image("image", path))); view.add(clickableImg);
>> this.add(view); ..
>> >> >
>> >> > and markup:
>> >> > <wicket:panel>
>> >> >        <a wicket:id="fotoPath" title="" rel="lightbox[svatebni]"
>> >> > href="#">
>> >> >                <img wicket:id="image" width="90px"
>> border="2px" />
>> >> >        </a>
>> >> > </wicket:panel>
>> >> >
>> >> > It works, but in final markup there is:
>> >> > <a href="photo/01_sv_76.jpg" rel="lightbox[test]" title="">
>> >> >        <img border="2px" width="90px"
>> >> >
>> src="resources/eu.testApp.MyPagePhotoRepeater/phfoto/01_sv_76.jpg"/
>> >> > >
>> >> > </a>
>> >> >
>> >> > so image is shown (right path to image resource) but not
>> clickable
>> >> > (wrong path). I'm using ExternalLink in wrong way but I
>> >> don't know the
>> >> > right way. Can you help me gyus, please?
>> >> >
>> >> > Laco
>> >> >
>> >> >
>> >> >
>> >>
>> ---------------------------------------------------------------------
>> >> > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
>> >> > For additional commands, e-mail: users-h...@wicket.apache.org
>> >> >
>> >> >
>> >>
>> >>
>> ---------------------------------------------------------------------
>> >> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
>> >> For additional commands, e-mail: users-h...@wicket.apache.org
>> >>
>> >>
>> >
>> >
>> >
>> ---------------------------------------------------------------------
>> > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
>> > For additional commands, e-mail: users-h...@wicket.apache.org
>> >
>> >
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
>> For additional commands, e-mail: users-h...@wicket.apache.org
>>
>>
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org

Reply via email to