You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Delange <de...@telfort.nl> on 2013/01/14 22:45:44 UTC

Image does not appears not always

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: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Image does not appears not always

Posted by Delange <de...@telfort.nl>.
I show that the text was changed, here again, i remove the start end  html 
characters

With a good result
           div class="opdoms"
              img src="./?20-IResourceListener-opdrachten-1-image"
class="opdimage" width="75" height="50"/
              <div>test</div
           /div
When bad:

           div class=&quot;opdoms&quot;
               img src=&quot;./?1-IResourceListener-opdrachten-1-image&quot;
class=&quot;opdimage&quot; width=&quot;75&quot; height=&quot;50&quot;/
              div>test</div
           /div

And sometimes a message appears in my dos box (from jetty environment)
18:53:12,512 ERROR DefaultExceptionMapper:105 - Connection lost, give up
responding.
org.apache.wicket.protocol.http.servlet.ResponseIOException:
org.mortbay.jetty.EofException
        at
org.apache.wicket.protocol.http.servlet.ServletWebResponse.write(ServletWebResponse.java:123)
        at
org.apache.wicket.protocol.http.HeaderBufferingWebResponse.write(HeaderBufferingWebResponse.java:181)
        at
org.apache.wicket.request.resource.ContextRelativeResource$1.writeData(ContextRelativeResource.java:99)
        at
org.apache.wicket.request.resource.AbstractResource.respond(AbstractResource.java:497)
        at
org.apache.wicket.markup.html.image.resource.LocalizedImageResource.onResourceRequested(LocalizedImageResource.java:201)



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

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


Re: Image does not appears not always

Posted by Delange <de...@telfort.nl>.
When things go well

           <div class="opdoms">
               <./?6-IResourceListener-opdrachten-1-image> 
              <div>test</div>
           </div>

When wrong (when no picture is found)
           <div class="opdoms">
               <./?1-IResourceListener-opdrachten-1-image> 
              <div>test</div>
           </div>
           <div class="opdoms">
               <./?3-IResourceListener-opdrachten-1-image> 
              <div>test</div>
           </div>
And the url
http://localhost:8080/Mercado/?32




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

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


Re: Image does not appears not always

Posted by Martin Grigorov <mg...@apache.org>.
What do you see in the produced html ?


On Mon, Jan 14, 2013 at 11:45 PM, Delange <de...@telfort.nl> wrote:

> 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: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>


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