10 Replies Latest reply on Jul 22, 2010 7:18 AM by kenanaydin1905

    Why s:graphicImage can not show bmp?

    loveseam
      
            <s:graphicImage value="/img/company_logo.bmp"/>
      
      

        • 1. Re: Why s:graphicImage can not show bmp?
          gonzalad

          Same problem here, with Seam 2.2.0.GA.


          I'm using this :


          <s:graphicImage value="/img/google12.bmp"/>



          And when I call my page, I have the following stackTrace :



          java.lang.NullPointerException
               at org.jboss.seam.ui.graphicImage.Image.getImage(Image.java:154)
               at org.jboss.seam.ui.graphicImage.GraphicImageRendererBase.doEncodeBegin(GraphicImageRendererBase.java:44)
               at org.jboss.seam.ui.util.cdk.RendererBase.encodeBegin(RendererBase.java:79)
               at javax.faces.component.UIComponentBase.encodeBegin(UIComponentBase.java:813)
               at javax.faces.component.UIComponent.encodeAll(UIComponent.java:928)
               at javax.faces.component.UIComponent.encodeAll(UIComponent.java:933)
               at com.sun.facelets.FaceletViewHandler.renderView(FaceletViewHandler.java:592)


          • 2. Re: Why s:graphicImage can not show bmp?
            gonzalad

            Sorry, issue already submitted in JIRA : JBSEAM-3917

            • 3. Re: Why s:graphicImage can not show bmp?
              gonzalad

              Hello,


              Does someone has an idea of how I can extend Seam to add bmp image handling ?


              I've just patched org.jboss.seam.ui.graphicImage.Image, by adding IMAGE_BMP field in enum type, and it works fine :


                 public enum Type
                 {
                    IMAGE_PNG("image/png", ".png", "PNG"), IMAGE_JPEG("image/jpeg", ".jpg", "JPEG", "image/jpg"), IMAGE_GIF(
                             "image/gif", ".gif", "GIF"), IMAGE_BMP("image/bmp", ".bmp", "bmp");




              But how can I extend Seam without patching it (I must add IMAGE_BMP value in an enum, and I suppose it's impossible - enum values are immutable I think).


              If enum values are immutable, shouldn't it be better to modify Seam base code (make Type a java class) in order to be able to extend it in the future ?


              Thanks for your help

              • 4. Re: Why s:graphicImage can not show bmp?
                thokuest

                If you do not create the bmp dynamically from your Seam component, use <h:graphicImage> instead of <s:graphicImage>.

                • 5. Re: Why s:graphicImage can not show bmp?
                  gonzalad


                  If you do not create the bmp dynamically from your Seam component, use <h:graphicImage> instead of <s:graphicImage>.




                  Problem is I create bmp dynamically ;((




                  • 6. Re: Why s:graphicImage can not show bmp?
                    gonzalad

                    Or rather : I upload the image into my database (LOB) and download it afterwards.

                    • 7. Re: Why s:graphicImage can not show bmp?
                      thokuest

                      Ok, understood. Either you convert the bmp into a web friendly format (e.g via ImageIO) or you patch Seam as you already suggested.

                      • 8. Re: Why s:graphicImage can not show bmp?
                        gonzalad

                        Thanks Thomas !


                        I've added my vote for this JIRA issue. Meanwhile, I'm dropping support for bmp files in my application. I won't add it only of explicitly requested by my users (I prefer to avoid patching Seam codebase even if it's a trivial patch).

                        • 9. Re: Why s:graphicImage can not show bmp?
                          thokuest

                          Unfortunately, Seam 2 is at the end of its lifetime. Even if you submit a patch, I don't think this issue gets fixed. Another solution to serve dynamically created bmp images would be to use a servlet.


                          Hope that helps!

                          • 10. Re: Why s:graphicImage can not show bmp?
                            kenanaydin1905

                            BUT; İT DİSPLAYS ITS IMAGES FOR EXAMPLES SEAMLOGO IMAGE AND ALSO ERROR IMAGE.YOU CAN USE  FOR BMP, JPEG AND THE OTHERS