How to set the size of an image

hi,
I have a database which contain an image. now i want to retrieve this image & want to show this image in my jsp page as user's defined size. I have following code. My following code shows the original size of an image. Now i want to see different size of this image. How is this possible? I know control the size of this image after saving this image
in a file. but i want to control the size of this image without saving this image in a file? IS it possible ? Is there anybody can help me?
Please help me.
ResultSet rs = null;
PreparedStatement ps=null;
     InputStream sImage=null;
     byte[] imagebyte=null;
     String var;
     String name=request.getParameter("RegName") ;
     String image =request.getParameter("ImageFile");
     out.println(name);
     out.println(image);
     out.println();
     ps=con.prepareStatement("insert into t_image (ID, Image) values(?,?);");
       File file =new File(image);
    FileInputStream in = new FileInputStream(file);
    ps.setInt(1,1234);
    ps.setBinaryStream(2,in,(int)file.length());
    ps.execute();  
    rs =stm.executeQuery("select Image from t_image where ID=1234");
    if(rs.next()) {
   imagebyte =rs.getBytes(1);
    response.reset();
    response.setContentType("image/jpeg");
    %>
<%
response.getOutputStream().write(imagebyte);
%>
<%
    response.flushBuffer();
%>With regards
Bina

hi,
I have a database which contain an image. now i
want to retrieve this image & want to show this
image in my jsp page as user's defined size. I have
following code. My following code shows the original
size of an image. Now i want to see different size
of this image. How is this possible? I know control
the size of this image after saving this image
n a file. but i want to control the size of this
image without saving this image in a file? IS it
possible ? Is there anybody can help me?This has nothing to do with JDBC; you can only store and retrieve the image you have and there's no image manipulation functions in JDBC (nor should there be).
I can see 2 options:
1) serve the image file as is, but in the jsp that writes the html that contains the "<img>" tag that gets it, use the "height" and/or the "width" to scale the suppied image to presentation size you want.
2) find some image manipulation code that will convert the image into the size you want
Option 1 will work well if the problem you have is merely refining the image size for presentation. Option 2 is your only coice if it's the image files size itself you really want to change, not just it's appearance on a page.

Similar Messages

  • How can I set the size of an image in java?

    How can I set the size of an image in java? I have to choose the width and height of image...thanks to everybody...sorry for my english :-)

    Hi 43477
    Can you provide more details, do you want to setsize to display an image on a screen of when saving image etc?
    PS.
    There is a good invention called googlegoogle is good, but sometimes it's better to use more specific search, there is a search field avove on this page :)

  • How to decrease the size of an image (CS5)?

    I need help with how to reduce the size of an image to fit various smaller sizes.  E.g. 135 x 380mm, 254 x254mm etc mounted/matted. Therefore, the image must be made smaller than these sizes without losing quality and any part of the image. I am unable to crop to achieve these sizes since I need the full image. These photos were taken by using a Canon D450 camera and in both RAW & JPEG.
    Your help is much appreciated.

    You may want to use Image > Image size... and dial in the sizes you want.
    Set your units to mm in the dialog. Turn off resample and you can adjust the final print size.
    What I am showing you is called "scaling", changing the print size without throwing out pixels as resample would do. Your image is  intact. This is from CS6, but it should be about the same in CS5.
    Gene

  • How to set the size of a JTabbedane to the size of the frame

    I have a tabbed pane in a frame, I would like to know how to set the size of the tabbed pane, so that it occupies the whole of the frame which has been set to screen size.
    Thanks

    Is it not possible to use it with a GridBagLayout?Your question was "How do I get a tabbed pane to take all the space of the frame"?
    You where given the answer. Did you try it? Did it work? Then why are you questioning the suggestion?
    Its one line of code if you use a BorderLayout which by the way was specifically designed for this purpose.
    Yes you can do it with a GridBagLayout with about 5 lines of code.
    So the question is why would you want to write 5 lines of code when you can use one?
    If your question was "How do I waste my time forcing the GridBagLayout to size a component to take up all the space of the frame", then you would have received a different answer. (Although most people would have told you to use a BorderLayout anyway, since its easier).

  • How to modify the blob size, or how to set the size?

    i want to know how to modify the blob size, or how to set the size?
    what's the default size of blob?
    Thanks in advance.

    Blob datatype can contain binary data with a maximum size of 4 GB.
    when you enter 10kb file, the database will only use 10kb to store the file (depending on block size etc)
    if you want to modify the blob size, you may do like this:
    SQL> create materialized view t_mv refresh fast on commit
    2 as select id, dbms_lob.getlength(x) len from t;
    Materialized view created.
    SQL> alter table t_mv add constraint t_mv_chk check (len < 100);
    Table altered.

  • How to control the size of SVG images in epub files?

    There is unfortunately no support for SVG files in InDesign.
    Most of my images in jpg convertes nicely, but the small ones do not.
    Therefore I want to use SVG files which I have created in Illustrator.
    But how do I set the size in the epub file? Right now, whatever I do, they come out too big and I don't know how to control the size.
    Is there a program, like Sigil or other, that can place the image for me - I'm no html wizard you see....

    In any Java program, it is good practice to make sure your live objects leave some room in the heap for "scratch space." Without this, you will spend too much time in GC, and, in the worst cases, run out of memory. In the general case, you can see how much live data your application requires by looking at the heap used after a full GC's. For Coherence, you should ensure that live data, as you say, is under 70% of the maximum heap size.
    Coherence provides you tools to help enforce this policy. [http://coherence.oracle.com/display/COH35UG/local-scheme] describes how to size limit your cache. By implementing an eviction policy, you can control what happens when a size limit is exceeded.

  • How to set the size for height of iView tray?

    Hi,
    I have created a ABAP webdynpro component and integrated this comp with iView. Then i integrated iView into Page in portal. That is working fine.
    But the size of tray/window which is displayed in the page is very small.
    How to increase the height of that Tray/window/iView containing my component?

    Hi,
    By changing the maximum automatic height and Minimum automatic height property of the iview you can set the size for height of your iview.
    to do this follow the setps:
    goto content administrator -> portal content -> your folder where you created your iview or directly to your iview -> right click -> open -> object,
    and now in property category choose appearance-Size from the drop down menu and set the above properties to your required height.
    if you want the end user to modify this property set the property to read/write .
    *********please reward points if the information is helpful to you********************

  • How to set the size of printing subject

    I have a deskjet 3520 all in one and my computer is a laptop dv6 with windows7 prof. 64bit.
    I want to print out PCB traces so that I can make my own but I don't know to how set the size
    with this printer. They take up the whole page when I want them to be 2.35x3.35.
    Don't know if this can be done with this printer.
    Any help would be apreciated.
    This question was solved.
    View Solution.

    Can you post a link to a sample, or upload here a sample?  That would make it easier to debug what is going on.
    Bob Headrick,  HP Expert
    I am not an employee of HP, I am a volunteer posting here on my own time.
    If your problem is solved please click the "Accept as Solution" button ------------V
    If my answer was helpful please click the "Thumbs Up" to say "Thank You"--V

  • How to set the size of SUM()/SUM() of NUMBER Tyep?

    I met the oracle truncation error when I post the
    SUM(a field)/SUM(b field), a and b field are NUMBER Type
    From the OCI Doc, Numbers with up to 38 digits precision.
    and I set the size of data buffer 41 for NUMBER TYPE.
    (for example)
    rc = OCIDefineByPos( hstmt, &m_pDefine, ((CEBOracle *)pDatabase)->m_hpErr, index,
                   (dvoid *) m_lpszBindData, m_nBufSize+1, SQLT_STR,
                   (dvoid *) m_cbIndicator, (ub2 *) 0, (ub2 *) 0, OCI_DEFAULT);
    I always set the output datatype as SQLT_STR
    and m_nBufSize is 41 for NUMBER Type
    my client met the error when the result is 0.00012345678912345678912345678912345678912
    I think that it's not a solution that just enlarge the number form 41 -> 45
    How can I avoid this problem when user send the SQL Statement that the result has unlimited decimal number?
    Thank you in advancd

    ORA-01406 fetched column value was truncated
    I found the reason of that problem.
    I migrated from OCI Ver7 to Ver8
    If I set the buffer size to 10 (actually 40 in my program) and the result was
    0.0000000000000000001
    When I debuged the output buffer
    The result was 1.0E-19
    but now 0.00000000 and truncation error
    how to change floating point and scientific expression automatically depend on the result like OCI Ver7 and SQL PLUS?
    I changed define function
    odefin(m_hstmt, ii+1, (UCHAR *) m_lpszData[ii], m_lpLength[ii]+1, SQLT_STR, -1, m_lpcbValue[ii], 0, -1, -1, 0, 0);
    to
    m_rc = OCIDefineByPos( m_hstmt, &pDef, ((CEBOracle*) m_pDatabase)->m_hpErr, ii+1,
              (dvoid *) m_lpszData[ii], m_lpLength[ii]+1, SQLT_STR,
              (dvoid *) m_lpcbValue[ii], (ub2 *) 0, (ub2 *) 0, OCI_DEFAULT );

  • How to set the size of popups from KM Navigation Iview

    Hello guys
    Does any of you know how I can set the size of the window that pops up when you click on a resource/file in a KM navigation iview?
    I have tried to enter "width=100,height=100" (without the quotes) in the Window Features property of the KM Navigation Iview, but it does not influence the size of the popups.
    Any suggestions to what could be wrong? Or is it not possible at all to control the size of that popup?
    Kind regards,
    Martin

    Hi,
    I cheched yesterday if I could find the command, sorry I couldn't.
    I also realized that the layout generates html link tags (ie. <a />) for the resource links, no javascript open link functions (ie. window.open), wich doesn't alowed (as far as I know) to give size to the pop-up window.
    So to make the link of the resource (gived by the <b>displayname(contectlink)</b> property set) I think you would have to <i>create (develop)</i> the layout, so the link will be rendered with window_size.
    You have other option, you can take off the "<i>contentLink</i>" setting. and add the <b>download</b> command, so the user who want to open / save the document can click on this command and do it in their PC.
    I.E, Create a copy of the <b>download</b>, and add this to the Collection render displayed porpeties:
    rnd:command(command=Z_download/style=link)
    You ca also use and icon to represent the download (you can set that icon in the command)
    I.E, rnd:command(command=Z_download_icon/style=icon)
    This last options represents a problem with the km-only-read content like xml files generaded by xml forms, it can only be readed in the km-portal.
    I hope this might help you.
    Best regards,
    Jorge M.

  • How to set the size of JTextPane according to the size of text??

    hello
    how can i set the size of JTextPane according to the size of text it would contain in such a way that JTextPane should not have ScrollBar.

    StanislavL wrote:
    width should be defined for your container width. suppose you have a very long row of text. Widht full screen widht it wraps into 2 lines but if you set widht of your window to half screen widht there should be 4 lines.
    But you can use the same code and get preferred widht as well.u mean like this :
    objTextPane.getParent().getWidth();Edited by: 811243 on Sep 6, 2011 5:32 AM

  • How to set the size of combo box  using jsf

    I face problem when i set the size of a combo in jsf

    Is it not possible to use it with a GridBagLayout?Your question was "How do I get a tabbed pane to take all the space of the frame"?
    You where given the answer. Did you try it? Did it work? Then why are you questioning the suggestion?
    Its one line of code if you use a BorderLayout which by the way was specifically designed for this purpose.
    Yes you can do it with a GridBagLayout with about 5 lines of code.
    So the question is why would you want to write 5 lines of code when you can use one?
    If your question was "How do I waste my time forcing the GridBagLayout to size a component to take up all the space of the frame", then you would have received a different answer. (Although most people would have told you to use a BorderLayout anyway, since its easier).

  • How to set the size of the frame in the decoration controls

    Hi,
    I am drawing some frames or boxes using the patterns in the "Decorations" control in labview.
    Is there other way to set the size of the frames or boxes rather than to drag them? also how can I change the color of the borders?
    Thanks,
    Joyce
    Solved!
    Go to Solution.

    Select the item.  Go to the Resize Objects button on the toolbar.  Pick the last one which shows a resize within a dialog bubble.  Now a dialog pops up which lets you define the height and width.
    To color something, Shift right click to bring up the toolbox.  Pick the paint brush.  Click on the thing you want to change such as the border.  It might now be the wrong color, so right click which brings up the color picker.  Now select the color you actually want.  If you want something to be transparent, pick the T at the upper right corner of the color dialog box.

  • How to set the size of a Font in Pixel?

    Hi,
    i know how to get the screen resolution of the current monitor and I know how to use Fonts (and I know how to read the API, but that didnt help).
    Is there a way to set the size (or at least the height) of a Font in pixel rather then in points?
    All I actually need is how many pixels the height of my String will be when I print it on the screen.
    I use Swing and drawString(...) to draw my String (this information shouldnt matter, but just in case).
    thanx

    Hi,
    search doc about FontMetrics, you'll find infos about how to get the font height... If I remember well, you need to get the Graphics of the component, then call getFontMetrics() or getFontMetrics(font) to obtain the metrics, then call getHeight() to know the font height...

  • How to set the size and position of JFrame

    hey all,
    i have a frame and i devide the frame into three panels, i want to make the top panel the lergest and make it square. and the rest two panels in small and in the bottom of the frame.
    could you please help me to set the size and position of the jpanel
    Thanks

    If u want the bottom 2 panels to be on the same level, u can try setting ur content pane to use the BorderLayout and the adding the 3 panels to it with BorderLayout.NORTH(for the TOP panel), BorderLayout.EAST(RIGHT panel) and BorderLayout.WEST(for LEFT panel).
    Don't know if this is what ur looking for, maybe u could describe more on ur layout with a sample image or something?

Maybe you are looking for

  • Migrating from G5 OS 10.4.11 PPC to  iMac running Leop. on Intel - problems

    Can anyone tell me what problems I will encounter migrating my G5 PPC to a brand new Intel iMac? Various forums give me conflicts (some of the ppc apps will run just fine, some will need to be re-installed [though good luck finding all of the install

  • New notebook only has headphone out and mic in -- Will any Creative speakers work?

    Hello all: My new notebook only has a headphone out and mic in, and no audio out as you see on desktop PCs. I prefer not to use my USBs as I have other devices using them. Are there any Creative speakers which can use the headphone output and convert

  • Tax field is not updated in COPA documents

    Hi There is a Value field for Tax is not updated in COPA documents due to missing configuration in KE4I. Now the tax field is updatating properly after completed the configuration in KE4I. But we have couple of COPA documents which are generated (sou

  • Migrating from Outlook 2007 to Entourage 2008

    15 days ago, I bought my first Mac after a 12-year gap. I have been trying to get my information from Outlook 2007 into Entourage 2008 without any luck. I've google'd and found that there are indirect paths only. (via mbox). My E08 refuses to recogni

  • How to setup vpn-server in Mountain Lion 10.8.3?

    Before I updated my mac mini server to 10.8.3 I used Server Admin to setup a vpn server. After the update Server Admin isn't supported anymore and my vpn settings are gone. Now i want to setup the server again, but have no clue what settings to enter