Loading an image from a url.

I was wondering if it were possible to load an image (just a jpg) from a url. The closest I've come is loading an .mpg from a url or loading an jpg locally using the importIcon function. I can't seem to find anything in the javascript api for this.

URLConnection.getInputStream()with reading from URLConnection.getInputStream() i can't manipulate any data. it's not possible to read some bytes and "unread" modified bytes.

Similar Messages

  • [noob needs help] Loading image from a URL

    Hey everyone. I'm new here. And I'm new at J2ME as well.
    I have a simple school project and I have doubts about it. I've searched everywhere on the net yet I could not find the solution. Anyways, I do understand the concept of loading images by putting the files in the "res" folder and use:
    try
    img = Image.createImage("/burgerimgsmall.jpg");
    catch (Exception e)
    e.printStackTrace();
    But my project requires me to load an image from a URL. How do I go about doing that? If it helps, here's the URL:
    http://img.photobucket.com/albums/v703/punkgila/burgerimgsmall.jpg
    Thanks guys!

    Don't worry, downloading image from http is also simple. Look into Photoalbum demo in wtk2.5

  • Loading an image from an arbitrary URL without using an ImageIcon

    Can anybody maybe point me in the direction of other (as in harder-to-use, but more flexible) ways to load an image from a URL?

    Interesting results:
    When I run this test code (the names have been changed to protect the innocent):
    package graphicstest;
    import javax.swing.*;
    import java.net.*;
    import javax.imageio.*;
    import java.awt.image.*;
    * <p>Title: </p>
    * <p>Description: </p>
    * <p>Copyright: Copyright (c) 2007</p>
    * <p>Company: </p>
    * @author not attributable
    * @version 1.0
    public class Foo
        extends JFrame {
      static ImageIcon ii;
      public Foo() {
        setSize(200,200);
        try {
          System.out.println("2=aborted; 8=complete; 4=errored; 1=loading");
          ii = new ImageIcon(new URL("http://intranet/part?FOO.JPG"));
          System.out.println("image load status: " + ii.getImageLoadStatus());
          getContentPane().add(new JLabel(ii));
          System.out.println("image load status: " + ii.getImageLoadStatus());
        }catch(Throwable t) {t.printStackTrace();}
      public static void main(String args[]) {
          Foo foo = new Foo();
          foo.setVisible(true);
          if (ii.getImageLoadStatus() == 4) {
            try {
              BufferedImage bi = ImageIO.read(new URL(
                    "http://intranet/part?FOO.JPG"));
              ii.setImage(bi);
              foo.validate();
              foo.repaint();
            } catch(Throwable t) {t.printStackTrace();};
    }. . . from a box that's not on the VPN, it blows up at the ImageIO.read() call (not unexpectedly). But if I run it from a box that's on the VPN, and able to access the URL, then it returns just fine from the ImageIO.read(), and I get a null pointer exception at the call to setImage().
    Clearly, this is trying to tell me SOMETHING, but I don't quite know WHAT.
    JHHL

  • Display an image from a URL

    Hi,
    I've looked through the Java Swing tutorial and I've searched the forums here, but I haven't figured out how to load an image from a URL into my GUI and display it.
    I don't want the image to be at certain coordinates, as I am using the FlowLayout. My problem is: how do I load an image from a URL, then display it in a JPanel, such as a JScrollPane?
    I'm sorry if I missed any tutorials or similar things about this topic, but if anyone could provide some advice, I would appreciate it.
    Thanks,
    Dan

    try this:
              try {
                   JLabel label = new JLabel(new ImageIcon(new URL("http://developers.sun.com/forums/img/gold.gif")));
                   JScrollPane sp = new JScrollPane(label);
              catch (MalformedURLException x) {
                   x.printStackTrace();
              }

  • Multiple images from static URL

    I am currently writing an applet that grabs radar images from a static URL. The image on the URL is updated every 15 minutes. I have a timer that will grab the image every 15 minutes and put it in an image[] array. Eventually I will be looping these images, and let the user define how far back to loop and how fast the loop is. Right now, though, every image it grabs is the same as the very first one. For testing purposes I have the URL currently set to an online panda cam with a timestamp (so I dont have to wait 30 minutes every build to see if it works on the radar URL). If I start the program at 12:47:51(timestamp on webcam) , it grabs a new image every 10 seconds. After a few minutes I have an array of images with the timestamp 12:47:51, every image is identical.

    well, I have the url
    "url"
    and the image[] array
    "imageArray[x]"
    in the actionPerformed for the timer:
    imageArray[x] = getImage(url); Currently I just have a button to step thru the images.
                        backg.drawImage(imageArray[counter],0,0,radarWidth,radarHeight,Color.white,this);Just to see if that worked I loaded the array with images from different URLs, and I was able to display them all without problem. Just when I use the static URL do I get the problem of the repeated image.

  • Error While loading a image from database

    Purpose
    Error While loading the Image from the database
    ORA-06502: PL/SQL : numeric or value error:Character string buffer too small
    ORA-06512: at "Sys.HTP" ,line 1480
    Requirement:
    I am developing the web pages using PSP(Pl/sql Serverpages) . I have a requirement to show a image in the webpage. I got the following procedures from the oracle website.
    I have created the following table to store the images
    create table DEMO
    ID INTEGER not null,
    THEBLOB BLOB
    And I also uploaded the Images. Now I am try to get a image from the table using the following procedure .But I am getting the error message line 25( htp.prn( utl_raw.cast_to_varchar2( l_raw ) );) .at it throws the following error messages
    ORA-06502: PL/SQL : numeric or value error:Character string buffer too small
    ORA-06512: at "Sys.HTP" ,line 1480
    Procedure that I used to get the image
    create or replace package body image_get
    as
    procedure gif( p_id in demo.id%type )
    is
    l_lob blob;
    l_amt number default 30;
    l_off number default 1;
    l_raw raw(4096);
    begin
    select theBlob into l_lob
    from demo
    where id = p_id;
    -- make sure to change this for your type!
    owa_util.mime_header( 'image/gif' );
    begin
    loop
    dbms_lob.read( l_lob, l_amt, l_off, l_raw );
    -- it is vital to use htp.PRN to avoid
    -- spurious line feeds getting added to your
    -- document
    htp.prn( utl_raw.cast_to_varchar2( l_raw ) );
    l_off := l_off+l_amt;
    l_amt := 4096;
    end loop;
    exception
    when no_data_found then
    NULL;
    end;
    end;
    end;
    What I have to do to correct this problem. This demo procedure and table that I am downloaded from oracle. Some where I made a mistake. any help??
    Thanks,
    Nats

    Hi Satish,
    I have set the raw value as 3600 but still its gives the same error only. When I debug the procedure its throwing the error stack in
    SYS.htp.prn procedure of the following line of code
    if (rows_in < pack_after) then
    while ((len - loc) >= HTBUF_LEN)
    loop
    rows_in := rows_in + 1;
    htbuf(rows_in) := substr(cbuf, loc + 1, HTBUF_LEN);
    loc := loc + HTBUF_LEN;
    end loop;
    if (loc < len)
    then
    rows_in := rows_in + 1;
    htbuf(rows_in) := substr(cbuf, loc + 1);
    end if;
    return;
    end if;
    Its a system procedure. I don't no how to proceed .. I am really stucked on this....is their any other method to take picture from the database and displayed in the web page.....???? any idea..../suggesstion??
    Thanks for your help!!!.

  • JAVA, sqlserver - Need to load an image from the sql server database

    hi,
    I need to load an image from the sql server database using java. I have connected to the database and getting all other records except the records for a photo (datatype = LONGVARBINARY) and Remarks (datatype = LONGVARCHAR).
    I am using java and sql server db. The photo and remarks are stored in the db. and i need to show the image and the remarks fetching them from there.
    I get the error :
    Thread-9 org.hibernate.MappingException: No Dialect mapping for JDBC type: -1
    How can I achieve this?
    Thanks,
    Gargi

    Exactly. And are you using MySQL?
    No. You are using Microsoft SQL server if I have to believe your initial post. A quick google tells me that the dialect class to use is:
    org.hibernate.dialect.SQLServerDialect

  • I want to download an image from the url and image is in byte format

    hi
    i want to download an image from the url
    http://www.tidelinesonline.com/mobile/j2me_v1?reqType=imageJoin&imageCount=1&month=1&day=1&year=2008&id=1&imageWidth=230&imageHeight=216&imageDepth=8&imageUnits=feet&imageType=JPG&msisdn=456
    first 5 digits will be the length of the image,we need to download except first 5 digits and display an image file
    i need to finish this today
    pla reply if any body knows solution for this.
    thanks in advance
    Mraj

    You do not need to do anything - iPhoto always keeps the original and you can revert to it at any time
    If you want to be able to see the original and the cropped version in iPhoto at the same time duplicate the photo (this does not really duplicate but simply starts a new edit stream for the photo - command-d) and crop the duplicate
    LN

  • Inserting an image from an URL in a BLOB

    Hello all,
    As it's said in the title, I need a PL/SQL procedure to insert a image from web URL in a BLOB table column.
    How can I do that?
    Thanks in advance for your help.
    Max

    found this on the internet http://www.oracle-base.com/articles/misc/RetrievingHTMLandBinariesIntoTablesOverHTTP.php
    CREATE TABLE http_blob_test (
      id    NUMBER(10),
      url   VARCHAR2(255),
      data  BLOB,
      CONSTRAINT http_blob_test_pk PRIMARY KEY (id)
    CREATE SEQUENCE http_blob_test_seq;
    CREATE OR REPLACE PROCEDURE load_binary_from_url (p_url  IN  VARCHAR2) AS
      l_http_request   UTL_HTTP.req;
      l_http_response  UTL_HTTP.resp;
      l_blob           BLOB;
      l_raw            RAW(32767);
    BEGIN
      -- Initialize the BLOB.
      DBMS_LOB.createtemporary(l_blob, FALSE);
      -- Make a HTTP request and get the response.
      l_http_request  := UTL_HTTP.begin_request(p_url);
      l_http_response := UTL_HTTP.get_response(l_http_request);
      -- Copy the response into the BLOB.
      BEGIN
        LOOP
          UTL_HTTP.read_raw(l_http_response, l_raw, 32767);
          DBMS_LOB.writeappend (l_blob, UTL_RAW.length(l_raw), l_raw);
        END LOOP;
      EXCEPTION
        WHEN UTL_HTTP.end_of_body THEN
          UTL_HTTP.end_response(l_http_response);
      END;
      -- Insert the data into the table.
      INSERT INTO http_blob_test (id, url, data)
      VALUES (http_blob_test_seq.NEXTVAL, p_url, l_blob);
      -- Relase the resources associated with the temporary LOB.
      DBMS_LOB.freetemporary(l_blob);
    EXCEPTION
      WHEN OTHERS THEN
        UTL_HTTP.end_response(l_http_response);
        DBMS_LOB.freetemporary(l_blob);
        RAISE;
    END load_binary_from_url;
    EXEC load_binary_from_url('http://forums.oracle.com/forums/themes/english/resources/oralogo_small.gif');

  • Load multiple images from directory?

    What is the best way to use CF to load multiple images from a
    server directory please? I have CF calling a stored procedure that
    returns an array of file names. I am using a Flex front end, and
    wonder if I should just pass the file name array to Flex and let it
    loop through and load each image into an array. Or is it possible
    from within my CFC to use the file name array to get CF to grab the
    images and then pass that image array back to Flex? If so, is there
    any advantage to either approach? TIA,
    Mic.

    You don't want to pass the binaries to Flex, you should just
    give Flex the image names and load them via HTTP.

  • How can I best load RAW images from a Canon SX50?

    How can I best load RAW images from a Canon SX50?

    9Sorry, ........confused about this process.   When I attempted to Post the question I had entered, I was told a blank space could not be posted.  So, I reentered the Q in the "space"........ which apparently was the space for an answer....!! ??......)
    >  When I try to load RAW images taken by my Canon SX50 from the SD card, iPhoto 11 -  (iMac/OSX 10.6.8) tells me that it can't read the format or something like that.    OSX 10.6.8 came out before the SX50, thus, did not include the related program.           I want to shoot RAW on the SX50....... but I then want to load them into iPhoto....... which I do directly from pics I take with my Nikon D200.  
    Not sure if this will help.............

  • I can't down load my images from my Nikon D4 to Apeture.

    I can't down load my images from my Nikon D4 to Apeture.

    Hi skhart1998,
    I also use Nikon D4, D2H and D2Xs
    I use Nikon Transfert 2, the latest version, to download my shots to my MacBook Pro hard disk in a picture folder. After this I use Aperture Import to place the New folder created in the Nikon folder in the Aperture Inspector folder... This way, I always have the copy of my originals files.
    .jpg or .nef  work fine.
    Denis

  • Loading realscale image from memorycard.

    Hi.
    I made a big image (3550 x 2100 pixels), which my Nokia 6125 didn't zoom enough on the normal Picture preview.
    So I decided to make a program for it, so I could see all the details from the pic, and move around on the image. (Like zoom, but I need to get closer.. )
    First problem i encountered, was that 4mb application was too big to install on my memorycard... Darn limits...
    So I decided to add them seperately, that I'd load the image from the application.
    Well when I ran the "File Browser", there was 3 things:
    - ".." (Folder up)
    - "E:\" (crashes, no access)
    - "C:\" (crashes, no access)
    So any ideas how could I get it work properly?
    Thanks!

    hmm ... ok .. that sounds good .. but that means that
    a servlet must exsist at all time to display the
    required image.Servlets are usually instantiated by the servlet container upon an incoming request.

  • Saving an Image from a url

    I need to write a simple(even dos based) app that saves an image from a url (ie http://www.google.com/images/logo.gif) into c:\temp\*filename*
    thanks alot for the help

    Its just like reading/writing a regular file. Check out the 'Custom Networking" tutorial found on this page:
    http://java.sun.com/docs/books/tutorial/

  • Loading an image from CameraRoll - how long should it take ?

    Hi All
    I'm loading an image from the CameraRoll using this method http://www.flashandmath.com/mobile/cameraroll/
    Now on my iPad2 the image loads pretty instantaneously
    However on my iPhone4 it takes approx 8 seconds for the image to load.
    ( The time is taken after calling loader.loadFilePromise waiting for Event.COMPLETE ... i.e. the image to load )
    function onImgSelect(event:MediaEvent):void {
    var promise:MediaPromise = event.data as MediaPromise;
    removeBrowseListeners();
    loader = new Loader();
    loader.contentLoaderInfo.addEventListener(Event.COMPLETE, onImageLoaded);
    loader.contentLoaderInfo.addEventListener(ErrorEvent.ERROR, onError);
    loader.loadFilePromise(promise);
    The code base is the same. There are (at least) 2 differences :-
    1) The hardware (iPad vs phone)
    2) The number of images on the camera roll (approx 60 on iPad vs almost 900 on the phone)
    Has anyone else noticed such a difference in speed between devices / number of files ?
    Is there a better/quicker way to load an image from CameraRoll ?
    Is 8 seconds normal/acceptable (I show a busy indicator)
    Any help / suggestions/ observations most appreciated !

    If you opted for the Secure Erase and the account has a lot of data in it, then it could take days to complete.

Maybe you are looking for