Results 1 to 5 of 5
  1. #1
    mbschutlz97 is offline Member
    Join Date
    Jan 2014
    Posts
    30
    Rep Power
    0

    Default How to get images from Jsoup

    I know how to get the link for the GIF but how do I get the image and use it in java?

  2. #2
    gimbal2 is offline Just a guy
    Join Date
    Jun 2013
    Location
    Netherlands
    Posts
    4,365
    Rep Power
    6

    Default Re: How to get images from Jsoup

    The same way a browser does it - open a HTTP connection to the url and fetch it. You can use the built in URLConnection class, or even better the Apache HttpClient API.

    What exactly do you mean by "use it in Java" ? Depending on the answer to that, you may not even have to manually fetch the resource.
    "Syntactic sugar causes cancer of the semicolon." -- Alan Perlis

  3. #3
    mbschultz97 is offline Super OP Noob
    Join Date
    May 2014
    Location
    Virginia
    Posts
    65
    Rep Power
    0

    Default Re: How to get images from Jsoup

    Quote Originally Posted by gimbal2 View Post
    The same way a browser does it - open a HTTP connection to the url and fetch it. You can use the built in URLConnection class, or even better the Apache HttpClient API.

    What exactly do you mean by "use it in Java" ? Depending on the answer to that, you may not even have to manually fetch the resource.
    Right now I'm using JSoup to connect to nasdaq... i have it collect the current price and some other stuff but i want it to get the picture so i can use it on my gui... do i have to connect to the link of the picture to use it in java? and what method do i use to get the picture?

  4. #4
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    17,902
    Rep Power
    25

    Default Re: How to get images from Jsoup

    If you have the URL of the image file, the ImageIO class has methods that will read the image.
    If you don't understand my response, don't ignore it, ask a question.

  5. #5
    mbschultz97 is offline Super OP Noob
    Join Date
    May 2014
    Location
    Virginia
    Posts
    65
    Rep Power
    0

    Default Re: How to get images from Jsoup

    Quote Originally Posted by Norm View Post
    If you have the URL of the image file, the ImageIO class has methods that will read the image.
    Thanks, ImageIO works for what I'm trying to do :D

Similar Threads

  1. Jsoup help
    By mbschultz97 in forum New To Java
    Replies: 7
    Last Post: 05-12-2014, 04:25 AM
  2. Jsoup cant Login on Page
    By pedromoto4 in forum New To Java
    Replies: 2
    Last Post: 10-06-2013, 02:15 PM
  3. scraping using Jsoup
    By gvs048 in forum New To Java
    Replies: 12
    Last Post: 06-07-2013, 10:00 AM
  4. jsoup 1.7.2
    By java software in forum Java Software
    Replies: 0
    Last Post: 02-01-2013, 07:05 AM
  5. jsoup 1.6.2
    By java software in forum Java Software
    Replies: 0
    Last Post: 04-02-2012, 06:05 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •