Creating thumbnails using jsf

Hi,
I want to create thumbnails using jsf and facelets so that I can view the images from a folder which is queried by a jsf pages passing a argument to the page.

I think fail is not the answer.If you donot have solution you should not waste ur time.

Similar Messages

  • Create thumbnail using excessive memory

    I have the following code to read an image (in a file) and create a thumbnail image, writing it to a file:
    BufferedImage originalBufferedImage = ImageIO.read(new File(imagePathAndFileName));
    int originalWidth = originalBufferedImage.getWidth();
    int originalHeight = originalBufferedImage.getHeight();
    double scale = 0;
    if (((double)75 / originalWidth) <
    ((double)75 / originalHeight)) {
    scale = (double)75 / originalWidth;
    } else {
    scale = (double)75 / originalHeight;
    int width = (int)(originalWidth * scale);
    int height = (int)(originalHeight * scale);
    BufferedImage newBufferedImage = new BufferedImage(width, height, originalBufferedImage.getType());
    Graphics2D graphics2D = newBufferedImage.createGraphics();
    Canvas dummyObserver = new Canvas();
    Image scaledImage = originalBufferedImage.getScaledInstance(width, height, Image.SCALE_SMOOTH);
    graphics2D.drawImage(scaledImage, 0, 0, dummyObserver);
    javax.imageio.ImageIO.write(newBufferedImage, fileType, new File(thumbnailPathAndFileName));
    With a 1.9 Megabyte image, the call to ImageIO.read() tries to allocate 15 Megabytes of memory, as seen from the log (obtained in WebSphere 5.1 by setting an ALLOCATION_THRESHOLD limit):
    Allocation request for 15085072 bytes
    at java.awt.image.DataBufferByte.<init>(DataBufferByte.java:87)
    at java.awt.image.ComponentSampleModel.createDataBuffer(ComponentSampleModel.java:430)
    at java.awt.image.Raster.createWritableRaster(Raster.java:965)
    at javax.imageio.ImageTypeSpecifier.createBufferedImage(ImageTypeSpecifier.java:1146)
    at javax.imageio.ImageReader.getDestination(ImageReader.java:2868)
    at com.sun.imageio.plugins.jpeg.JPEGImageReader.readInternal(JPEGImageReader.java:914)
    at com.sun.imageio.plugins.jpeg.JPEGImageReader.read(JPEGImageReader.java:886)
    at javax.imageio.ImageIO.read(ImageIO.java:1413)
    at javax.imageio.ImageIO.read(ImageIO.java:1299)
    Why does it use 15M to read in an image of 1.9M ? Is there a more efficient way to create thumbnail images?

    A 15M image correponds to a 5M-pixel RGB 24-bit image. "ImageIO.read" decodes your 1.9M compressed jpeg (beeing roughly a 5Mpixel image, right?) file to a buffered image of some in-memory RGB 24bit format making it consuming 15M. You can get away with using less memory if you can find some ImageIO plugin returning a BufferedImage of type TYPE_CUSTOM with a compressed in-memory representation of the loaded image.
    Regards,
    Arvid

  • What is the fastest way to create thumbnails in CS6?

    Hi All...
    I wanted to know if there is a certain way you can take larger images and have them shrink down to a thumbnail size in an automated fashion?  Instead of having to load each image and change the dimensions and export the image as a thumbnail?  I'm using Web Premium CS6 and also have Lightroom 4.  There must be a less tedious method to create a small size and a large size image...
    Any thoughts?

    You can do this easily using Actions and Batching in Photoshop CS6.
    Here are two video tutorials on how to do this in CS6, specifically for creating thumbnails; using actions and batching actions. The guys is a little long-winded but is very comprehensive.
    And here's an article on how to do the same thing. It's from 2007 but explains the process nicely.

  • Can one create a floating window using JSF?

    I was recently shown the interface for GMail. I don't have a GMail account, but one of the things I was asked to investigate was whether or not we can create the sort of floating window that appears on the GMail interface when one positions the mouse pointer over a cell on the grid showing the email messgaes. We have a grid on our JSF page, that shows specific data for items we're supporting, and it would be useful if we could have something like a mouseover event handler for each table row, and in that event handler show a window with a graphic specific to the data in that row, and the chart would move with the mouse pointer, perhaps changing the graphic if the mouse pointer is moved over a different row in the data table.
    Can we do this using JSF? If not, what alternative can you suggest that would provide a reasonable facsimile to this kind of user friendly feature?
    Thanks
    Ted

    "Core JavaServer Faces" Second Edition, by David Geary and Cay Horstmann, copyr 2007 - ISBN: 0-13-173886-0 - (it put me back USD $50, but well worth it). Page 644 gives two examples of how to generate a pop-up window. They give two examples because of problems that can arise when you transfer data between the main window and the pop-up. I do not want to violate copyright and there are ten pages of text devoted to this topic, so I'll just present some tickler code - if you cannot afford the book, maybe you can google on some terms. Sorry, I feel this is as far as I can go on this, I hope this helps some!
    The first example uses a JavaScript call:
    popup = window.open(url, name, features);
    popup.focus();
    where 'features' is a string like "height=300,width=200,toolbar=no,menubar=no"
    The second example creates the pop-up form using a hidden field like this:
    <h:form id="hidden" target="popup">
    <h:inputHidden id="country" value="#{bb.country}"/>
    <h:commandlink id="go" action="showStates"/>
    </h:form>

  • Accessing or creating thumbnail images of pages to use in navigation

    In Bridge I can scroll through the Indesign pages by scrolling through the thumbnail images without opening the Indesign file.
    Is it possible to access those thumbnails so that I can use them as page navigation buttons in the Indesign file, or is there another way to create a thumbnail of the pages to reuse as buttons?
    thanks

    In the thread here I mention an external utility I wrote to extract the JPEG thumbnails that InDesign creates for use in Bridge. If you don't use Windows, google a bit to find a Javascript that does the same. (The difference is, you need to run the JS from within InDesign; my program works without.)
    Both the script and the program can only extract what's in the file: http://help.adobe.com/en_US/indesign/cs/using/WSa285fff53dea4f8617383751001ea8cb3f-6d51a.h tml
    (Similar to the above, a PDF may contain a per-page thumbnail, but I have no idea on how to extract those.)

  • Adobe Reader XI (11.0.08) doesn't create thumbnail (bitmap) using Microsoft Interface IExtractImage -- Extract on Windows Server 2008 R2, when exe to generate thumbnail is launched from Windows service.

    Adobe Reader XI (11.0.08) doesn't create thumbnail (bitmap) using Microsoft Interface IExtractImage --> Extract on Windows Server 2008 R2, when exe to generate thumbnail is launched from Windows service.
    But if exe is launched as standalone, then interface IExtractImage --> Extract, gives Bitmap to generate thumbnail of PDF document.
    Above problem occurs only for PDF documents, if we tried same with other software like CAD -CATIA it works without any problem.
    Is there any security concerns form PDF side, which doesn't allow to generate Bitmaps, if exe to generate it is launched form Windows service.

    It might be deliberate, Acrobat and Reader software is not intended to run in a service environment.

  • Issues in using JSF UI:Tree tag

    Hi,
    I am trying to work with Tree Structure using JSF UI tags. In Studio Creator i just created a JSP page and designed a Tree with two nodes under it. This is what i have in the body of my jsp.
    <ui:body binding="#{Page1.body1}" id="body1" style="-rave-layout: grid">
    <ui:form binding="#{Page1.form1}" id="form1">
    <ui:tree binding="#{Page1.tree1}" id="tree1" style="left: 48px; top: 48px; position: absolute" text="L3">
    <ui:treeNode binding="#{Page1.treeNode1}" expanded="true" id="treeNode1" style="width: 408px" text="Tree Node 1">
    <f:facet name="image">
    <ui:image binding="#{Page1.image1}" icon="TREE_DOCUMENT" id="image1"/>
    </f:facet>
    </ui:treeNode>
    <ui:treeNode binding="#{Page1.treeNode2}" expanded="true" id="treeNode2" text="Tree Node 2">
    <f:facet name="image">
    <ui:image binding="#{Page1.image2}" icon="TREE_DOCUMENT" id="image2"/>
    </f:facet>
    </ui:treeNode>
    </ui:tree>
    </ui:form>
    </ui:body>
    But when i am trying to launch the jsp page from browser i am getting the below exception.
    com.sun.rave.web.ui.appbase.ApplicationException
    Caused by: java.lang.NullPointerException at java.io.File.(File.java:194) at com.sun.rave.web.ui.renderer.template.xml.XMLLayoutDefinitionManager.getLayoutDefinition(XMLLayoutDefinitionManager.java:142) at com.sun.rave.web.ui.component.TemplateComponentBase.getLayoutDefinition(TemplateComponentBase.java:150) at com.sun.rave.web.ui.renderer.template.TemplateRenderer.encodeBegin(TemplateRenderer.java:73) at javax.faces.component.UIComponentBase.encodeBegin(UIComponentBase.java:683)
    Any suggestion to solve this issue would be greatly helpful.

    Now with Unified EL - JSTL and JSF tags are supposed to work on one page.
    If you want to use Unified EL you need
    1) A container that is built on Servlet 2.5 / JSP 2.1 , and example of such a container is Tomcat 6.x
    2) Probably need to upgrade to JSTL 1.2 , and JSF 1.2
    3) If you're upgrading the container to Servlet 2.5 then web.xml should conform to Servlet 2.5 version.
    4) Use correct taglib URIs for JSTL 1.2 and JSF 1.2
    Read here: Summary of new features in JSP 2.1
    http://java.sun.com/developer/technicalArticles/J2EE/jsp_21/index.html
    JSP 2.1 Technology and JSF 1.2 Technology
    http://java.sun.com/developer/community/chat/JavaLive/2004/jl1207.html
    http://java.sun.com/products/jsp/index.jsp
    Message was edited by:
    appy77

  • Using JSF and IFRAMEs

    I have a basic JSF app that takes some input, does a request and creates a table on output. What I need to do with it now is to have the query "page" and results "page" in two iframes on the same page. Before the query has been run the second iframe should just be blank (or with some default text). After the query that frame should be populated but the query frame needs to still be there. I've managed to do part of this. The "search" page and the "results" page are in separate iframes:
    <%@ page session="true" %>
    <html>
    <head>
      <title>Frames</title>
    </head>
    <body>
    <table>
      <tr>
        <td width="100%" colspan="2">
          <iframe title="Synonyms Search" src="search.jsf"
              width="800" height="200">
          Alternate search content...
          </iframe>
         </td>
      </tr>
      <tr>
      <td width="100%">
        <iframe src="results.jsp" title="Results"
          width="800" height="800">
          Results....
        </iframe>
      </td>
      </tr>
    </table>
    </body>
    </html>The reason this page is not using jsf tags is that the iframes will need to contain other pages that themselves are not jsf (mostly servlets) and I wasn't sure I could make that work. Currently the problem is that previously the search page had a QueryBean that the results page accessed to create it's table of results. Now in iframes the results.jsp frame just has a jsp processing exception and running the query does nothing. I'm new to JSF so I'm sure there's parts I'm missing, these do work if I pull them outside the frames and write navigation rules in the faces-context.xml file.
    Thanks,
    Sarah

    nigeldeakin wrote:
    The first thing to ask is whether you are sure that
         @Resource(name = "jms/QueueConnectionFactory",mappedName = "queueConnectionFactory")
         private ConnectionFactory connectionFactory;is valid. Does it work when you use it in other places?No it is not working still giving me NullPointerException for it. I'm using JBoss AS and having hard times deploying a jms queue on it i used an xml file to configure the queue and here is the file
    <?xml version="1.0" encoding="UTF-8"?>
    <server>
         <mbean code="org.jboss.jms.server.destination.QueueService"
              name="jboss.messaging.destination:service=Queue,name=StockHistoryQueue"
              xmbean-dd="xmdesc/Queue-xmbean.xml">
              <depends optional-attribute-name="ServerPeer">
                   jboss.messaging:service=ServerPeer
             </depends>
              <depends>jboss.messaging:service=PostOffice</depends>
         </mbean>
    </server>i think it's not working because i have this null exception for queue factory.

  • Portal Development using JSF & Struts

    Can some one explain about the feasibility of developing portals using JSF and Struts? What are the advantages and disadvantages of doing so? Is it a right decision to develop portal servers using these?

    Yes I am familiar with all those links. Let me break down scenario and ask specific questions.
    Server version: Netweaver 7.0 (2004s) SP18
    1. Created External Library DC (i.e. ebuslib)
             - added 3rd party JARS (e.g. hibernate, Spring)
             - created two public parts - one for compilation, one for assembly (deploy)
             - activated activity
    2. Create J2EE Server Component - Library DC (i.e. ebuslib2)
              - added "ebuslib" assembly PP as Used DC (build only)
    3. Built "ebuslib2"
              - can see jars in the resulting sda file.
              - activated activity
              - confirmed on J2EE engine deployed library containing the jars.
    Scenarios
    A. EP Project DC
               - needs access to 3rd party jars
               - QUESTION: What do I need to reference? The External Library DC or the J2EE Server Component Library DC?
                             - I read that you should reference the J2EE Server Component BUT the jars are not available in the PP of that DC.
                             - One developer one talked to referenced the compilation PP of the External Library DC (i.e. "ebuslib").
                                     - this seemed to work but then I wondered how the project finds the JAR at runtime?
    QUESTION: Does SAP load all the classes that have been deployed via the J2EE Server Component Library DC method and hence those JARs are globally available at runtime hence no need to reference them during development except for compilation? What if > 1 J2EE library contain the same jar or same API but different versions (e.g. Hibernate 2 vs 3).
    Thanks for any clarifications. I want to understand the underlying technology and how it works. I have seen alot of information out there but some of it is confusing and conflicting.
    Dean Cyril Wood

  • Using JSF in jsp segment page..

    Hello
    Is it possible to use JSF components in a JSP segment page(.jspf) ? I couldn't achive that..Let me explain:
    I created a .jspf file and inserted these lines into it:
    <f:view>
        <h:form id="loginform">
            <h:panelGrid columns="2">
                <h:outputLabel value="User:"/><h:inputText id="username_email"/>
                <h:outputLabel value="Password:"/><h:inputText id="password"/>
            </h:panelGrid>
        </h:form>
    </f:view>after that i included this .jspf file to a jsp file. When I run the application,I get this error:
    Stacktrace:
         org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:504)
         org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:375)
         org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
         org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
         org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:368)
    root cause
    javax.servlet.ServletException: Cannot find FacesContext
         org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:858)
         org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:791)
         org.apache.jsp.index_jsp._jspService(index_jsp.java:181)
         org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
         org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:332)
         org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
         org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
         org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:368)
    root cause
    javax.servlet.jsp.JspException: Cannot find FacesContext
         javax.faces.webapp.UIComponentTag.doStartTag(UIComponentTag.java:405)
         com.sun.faces.taglib.jsf_core.ViewTag.doStartTag(ViewTag.java:105)
         org.apache.jsp.index_jsp._jspx_meth_f_view_0(index_jsp.java:196)
         org.apache.jsp.index_jsp._jspService(index_jsp.java:113)
         org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
         org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:332)
         org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
         org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
         org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:368)
    note The full stack trace of the root cause is available in the Apache Tomcat/5.5.17 logs.

    I have tried both:
    logincontrol.jspf (1)
    <f:subview id="sv">
        <h:form id="loginform">
            <h:panelGrid columns="2">
                <h:outputLabel value="User:"/><h:inputText id="username_email"/>
                <h:outputLabel value="Pass:"/><h:inputText id="password"/>
            </h:panelGrid>
        </h:form>
    </f:subview>
    logincontrol.jspf (2)
    <f:view>
        <h:form id="loginform">
            <h:panelGrid columns="2">
                <h:outputLabel value="User:"/><h:inputText id="username_email"/>
                <h:outputLabel value="Pass:"/><h:inputText id="password"/>
            </h:panelGrid>
        </h:form>
    </f:view>but nothing changes... i added this line, in the .jsp file:
    <%@ include file="WEB-INF/jspf/logincontrol.jspf" %>   by the way, is it good to write a .jspf file for login process and include it to the pages?

  • Create Thumbnail Images

    Hello, I currently use Automator on Mac OS 10.4 Tiger. I most often use this program to create thumbnail images for easy web upload. However, I plan to upgrade my operating system to Leopard soon, and I was wondering, will my Automator workflows that I've created in Tiger work on the Leopard OS? If not, is their an equivalent automation on Leopard that will output thumbnail images?

    without knowing specifics it's hard to say anything definite but leopard automator includes everything Tiger automator had and a whole lot more. the action to create thumbnails is certainly present. you might have to remake the workflow from scratch but it will certainly work.

  • How to create thumbnail images on the fly from JSP or servlet?

    Hi all,
    Iam new to this forum. I need a solution for the problem iam facing in building my site. Ihave groups and briefcase section in my site. I allow users to upload files and pictures.
    When they upload pictures i need to create thumbnail for them on the fly.
    Is there any taglibs or java source to do this from JSP or servlets.
    It would be very greatful if i can get an early answer.
    Please let me know if there is any other forum where i can get better answer, if not here?
    thnx.

    Here is how you can create dynamic images:
    http://developer.java.sun.com/developer/JDCTechTips/2001/tt0821.html#tip2
    However, if you want to create gifs/jpegs and save them to the disk it depends from where you want to create the images. It is different if you are creating from another image or just drawing one from scratch etc.. But in the end you will probably need to use one of the imageencoder classes and write the result to the disk with the file io classes.

  • Creating thumbnail images and storing it as gif or jpg

    Hi all,
    Iam new to this forum. I need a solution for the problem iam facing in building my site. I have groups and briefcase section in my site. I allow users to upload files and pictures.
    When they upload pictures i need to create thumbnail for them and store them as gif or jpeg.
    It would be very greatful if i can get an early answer.
    Please let me know if there is any other forum where i can get better answer, if not here?
    thnx

    I found the following searching through the forum, under jpeg or thumbnail, a while back -- maybe you can use it:
    import java.awt.Image;
    import java.awt.Graphics2D;
    import java.awt.geom.AffineTransform;
    import java.awt.image.BufferedImage;
    import java.io.IOException;
    import java.io.OutputStream;
    import java.io.FileOutputStream;
    import javax.swing.ImageIcon;
    import com.sun.image.codec.jpeg.JPEGCodec;
    import com.sun.image.codec.jpeg.JPEGImageEncoder;
    class Thumbnail {
    public static void main(String[] args) {
    createThumbnail(args[0], args[1], Integer.parseInt(args[2]));
    * Reads an image in a file and creates a thumbnail in another file.
    * @param orig The name of image file.
    * @param thumb The name of thumbnail file. Will be created if necessary.
    * @param maxDim The width and height of the thumbnail must
    * be maxDim pixels or less.
    public static void createThumbnail(String orig, String thumb, int maxDim) {
    try {
    // Get the image from a file.
    Image inImage = new ImageIcon(orig).getImage();
    // Determine the scale.
    double scale = (double)maxDim/(double)inImage.getHeight(null);
    if (inImage.getWidth(null) > inImage.getHeight(null)) {
    scale = (double)maxDim/(double)inImage.getWidth(null);
    // Determine size of new image. One of them
    // should equal maxDim.
    int scaledW = (int)(scale*inImage.getWidth(null));
    int scaledH = (int)(scale*inImage.getHeight(null));
    // Create an image buffer in which to paint on.
    BufferedImage outImage = new BufferedImage(scaledW, scaledH,
    BufferedImage.TYPE_INT_RGB);
    // Set the scale.
    AffineTransform tx = new AffineTransform();
    // If the image is smaller than the desired image size,
    // don't bother scaling.
    if (scale < 1.0d) {
    tx.scale(scale, scale);
    // Paint image.
    Graphics2D g2d = outImage.createGraphics();
    g2d.drawImage(inImage, tx, null);
    g2d.dispose();
    // JPEG-encode the image and write to file.
    OutputStream os = new FileOutputStream(thumb);
    JPEGImageEncoder encoder = JPEGCodec.createJPEGEncoder(os);
    encoder.encode(outImage);
    os.close();
    } catch (IOException e) {
    e.printStackTrace();
    System.exit(0);
    V.V.

  • IDVD won't create thumbnail images in slide shows

    In a slide show, the window that used to show the photos in a slide show no longer renders thumbnails in the list or grid views. The status at the top of the window just sits there and spins forever, with the text "Creating thumbnail images...." Anyone know of a workaround?

    Neither of these "fixes" has changed anything. I also cleared my cache, ran a diagnostic check, and a virus/trojan scan! Either way, firefox 4 is just not working up to my needs! Should, or can I go back to 3.6?

  • Portlets developed in JDev 10.1.2 and using JSF

    Hi,
    Is it possible in JDeveloper 10.1.2 to create a portlet that uses the standard JSF libraries (not using Oracle ADF Faces libraries etc...), which can then be consumed by Oracle Portal 10.1.4, without having to use the JSF-Portlet bridge that is part of the WebCentre Suite ?
    The reason I ask is that I would like to develop portlets in JDeveloper 10.1.2 using JSF but I don't have a WebCentre Suite license. I don't think there is much point in moving to JDeveloper 10.1.3.2 to develop my portlets as I would still be in the same situation, I would ultimately need a WebCentre Suite license in order for them to be consumed by Oracle Portal 10.1.4, or am I missing something ?
    Thanks.

    Is it possible in JDeveloper 10.1.2 to create a portlet that uses the standard JSF libraries (not using Oracle ADF Faces libraries etc...), which can then be consumed by Oracle Portal 10.1.4, without having to use the JSF-Portlet bridge that is part of the WebCentre Suite ?
    The JSF Portlet Bridge is available separately.
    https://jsfportletbridge.dev.java.net/

Maybe you are looking for

  • Validation error on numeric field

    Hi, I am very new to Oracle Database and have only recently started learning SQL, PL/SQL and Apex. I have created a very simple stock control application with a report that lists the quantity of parts in locations with a button on each row that allow

  • Creating a document script for Clock in Acrobat Professional.

    Hi, I am trying to add a field on my PDF form which shows a continuous clock. I do not know how to add code to a document script in Acrobat Professional. "Advaned/ Javascript/ Set Document Actions" is greyed out. Thanks in advance, Damo.

  • Retrieve underlying SQL query for deski report via java SDK in BOXIR2

    Hi all, I am trying to retrieve underlying SQL queries of a deski report in BOXIR2. However I find the error as oDataProvider = oDocumentInstance.getDataProviders().getItem(i1);                System.out.print(oDataProvider.getName()); oSQLDataProvid

  • UCCE Not Ready Reason Code Removed after Internal Call

    Here is the scenario.  Agent puts themselves Not Ready which we have set to require a Not Ready reason.  They enter the reason and go about their business.  Someone internally calls their extension for whatever reason.  The agent takes the call and h

  • Windows live photo acquisitio​n wizard has stopped working

    my window live photo acquisition manager has stopped working,,, has anyone else experienced this ,, if so is there a solution to this error,