Skip to main content



      Home
Home » Newcomers » Newcomers » download images from internet
download images from internet [message #96199] Sun, 21 August 2005 18:29 Go to next message
Eclipse UserFriend
Originally posted by: vicenrico.gmail.com

i´m doing a program that tries to download an image from an URL, but i
don´t know how do it...
does somebody knows how i can reach that?????????

i think that can be with Imagereader, or getimage or new Imageicon?????

I hear some about awt images controls over SWT....but i don´t know.

Thanks!!
Re: download images from internet [message #96244 is a reply to message #96199] Mon, 22 August 2005 06:04 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: jeroen.verdrengh.student.kuleuven.be

In what way is your question related to eclipse?

http://www.google.be/search?q=java+load+image+URL
Re: download images from internet [message #96713 is a reply to message #96244] Mon, 22 August 2005 18:33 Go to previous message
Eclipse UserFriend
Originally posted by: vicenrico.gmail.com

Jeroen escribió:
> In what way is your question related to eclipse?
>
> http://www.google.be/search?q=java+load+image+URL
>
>
Well, yesterday i found it!!!

Anyway, thanks for reply... I wanted to know how load image from an Url
without using AWT....only with SWT...

i was playing with IMAGEIO, but i discovered Imagedata and company...

if useful, i post the snippet, very little snippet...

------------------------------------------------------------ -------------------------------
private void retrieveImage(String direccionImagen) {

ImageData[] imageDataArray,imageDataArray1;
URL url = null;
try {
url = new URL(direccionImagen);
} catch (MalformedURLException e) {

e.printStackTrace();
}
InputStream stream = null;
String urlfile=url.getFile();

NombreFichero nom=new NombreFichero(urlfile,'/'); //
// here i parse filename to obtain name of the image an
extension...for saving the image after..



try {
stream = url.openStream();
} catch (IOException e) {

e.printStackTrace();
}
ImageLoader loader = new ImageLoader();

imageDataArray = loader.load(stream);
String
pathCompleto=ProgramData.programImagesDir+System.getProperty ( "file.separator")+nom.nombreCompleto();
loader.save(pathCompleto,SWT.IMAGE_JPEG);


try {
stream.close();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}

int imageDataIndex = 0;
Image image = new Image(GUI.display, imageDataArray[imageDataIndex]);
Previous Topic:Configure Bea weblogic
Next Topic:JAR Packager : External JAR Files
Goto Forum:
  


Current Time: Sat Jul 19 18:44:25 EDT 2025

Powered by FUDForum. Page generated in 0.09707 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top