Thank you Igor! You don't know how long I tried to do this.

I've added this fix to the Wiki:
http://cwiki.apache.org/confluence/display/WICKET/How+to+load+an+external+image

-August



Igor Vaynberg wrote:
class staticimage extends webcomponent {

     public staticimage(string id, imodel model) {
                super(id, model);
      }

      protected void oncomponenttag(tag) {
          checkcomponenttag(tag, "img");
          tag.put("src", getModelObjectAsString());
        }
}

add(new staticimage("img", new Model("http://foo.com/bar.gif";));

-igor


On 12/27/06, *August Detlefsen* <[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>> wrote:

    How can I load an image directly from a url?

    For example I want to display a picture of a user next to their
    profile,
    but all of the images are served by another machine for better
    performance. I tried something like this but it won't compile:

                Image profileImg = new Image("profileimg");
                profileImg.setImageResource( new UrlResourceStream( new
    URL(user.getPhotourl()) ) );


    Thanks,
    August

    -------------------------------------------------------------------------

    Take Surveys. Earn Cash. Influence the Future of IT
    Join SourceForge.net's Techsay panel and you'll get the chance to
    share your
    opinions on IT & business topics through brief surveys - and earn
    cash
    http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
    <http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV>
    _______________________________________________
    Wicket-user mailing list
    Wicket-user@lists.sourceforge.net
    <mailto:Wicket-user@lists.sourceforge.net>
    https://lists.sourceforge.net/lists/listinfo/wicket-user
    <https://lists.sourceforge.net/lists/listinfo/wicket-user>



-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user

Reply via email to