I have a website where a user can upload images. On the first page, i always
show one image on this home page

Strange enough, mostly i can see the image but sometimes not.

What could be the reason that no image is shown?


@Html
<images/noimage.jpg> 


@Directory structure
wepapps
   mywebsite
        design 
            <with more subdirectories, name = a number, contains images0
        WEB-INF


@Java
String filename = "noimage.jpg";
File[] files = getUploadFolder(design.getNumber()).listFiles();
                                 
if (files != null && files.length > 0) {
        filename  = files[0].getName();
        item.add( getImage( design.getNumber() + "/" + filename) );
} else {
item.add(new Image("image", new
ContextRelativeResource("images/noimage.jpg")));
}

private Folder getUploadFolder(long designnumber) {
        String folderLocation = MyProperties.getImageLocation();
        Folder folder = new Folder(folderLocation+designnumber, "");
        folder.mkdirs();
        logger.info("path="+folder.getAbsolutePath());
        File[] files = folder.getFiles();
        return  folder; 
}
private Image getImage(String imageName){
        Image image =  new Image("image"  , new ContextRelativeResource(
"/design/"+imageName));
        return image;            
}



--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Image-does-not-appears-not-always-tp4655364.html
Sent from the Users forum mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to