GLBasic forum

Main forum => GLBasic - en => Topic started by: Omadan on 2011-Mar-25

Title: Downloading Images
Post by: Omadan on 2011-Mar-25
Yo mates, Hope some of you can help me with this, or direct me in the right direction.

I got some pics saved on my photobucket account.

I now just want to display the images from within Glbasic via the weblink. How is this done?

Never done this so any help would be greatly appreciated. Cmon Kitty hehe  :D
Title: Re: Downloading Images
Post by: ampos on 2011-Mar-25
Code (glbasic) Select
n=NETWEBGET("www.mysite.com",file$,80,docpath$+"/file.png",5000)
loadbmp docpat$+"file.png"
showscreen
Title: Re: Downloading Images
Post by: Omadan on 2011-Mar-25
ampos thanks for fast reply.
That does not work, and if I look at the .png saved to the file with the netwebget command, I get an invalid corrupt image file.
Nothing gets drawn to screen and it is because of that.

Thanks
Title: Re: Downloading Images
Post by: ampos on 2011-Mar-25
It works because it is working :)

If you want to download a file a thttp://www.google.es/images/logos/ps_logo2.png you have to use

n=netwebget("www.google.com","/images/logos/ps_logo2.png",80,"image.png",5000)
Title: Re: Downloading Images
Post by: Moebius on 2011-Mar-25
I'm not sure if this is the problem, but what image type are you trying to download?  Make sure the file you're saving to has the same extension as what you're downloading.
Title: Re: Downloading Images
Post by: Omadan on 2011-Mar-26
Hi ampos and serpent.
I am doing it right, I tried it with your link and it works with that Google image.
It does not work with photobucket though :(
anyone knows?
Title: Re: Downloading Images
Post by: Moebius on 2011-Mar-26
I meant, if you are using jpgs on photobucket, you should try:
n=netwebget("www.photobucket.com","/path/image.jpg",80,"image.jpg")

Can you post the code you're using anyway?  It's strange that this would be going wrong...
Title: Re: Downloading Images
Post by: Omadan on 2011-Mar-26
LOCAL ok%;
ok=NETWEBGET("www.photobucket.com","/albums/v180/joepitto/jap7.png",80,"LOGO.png",5000)
debug ok;// I get a 1 here showing success.

I go to folder and theres a .png file named LOGO.png. that can't be opened. I try it with the google image posted by ampos and it works with no problem.

If I paste the url http://www.photobucket.com/albums/v180/joepitto/jap7.png on the web browser it displays image perfectly too, meaning the url is okey too.  :S
Title: Re: Downloading Images
Post by: Moebius on 2011-Mar-26
Trying an image from photobucket, this is the sort of link you should get:
http://i587.photobucket.com/albums/ss312/m4l1k4y000/Decorated%20images/vintage-15.jpg

And this works for me (even though GLBasic fails at displaying the jpg  :whistle:)
Code (glbasic) Select
NETWEBGET("i587.photobucket.com", "/albums/ss312/m4l1k4y000/Decorated%20images/vintage-15.jpg", 80, "image.jpg")


The URL you're using is probably one you would use to display it in a browser, but not to get the image itself.
In fact, try these to check this:
1) Rename the file to ".html" and open it in a browser and see what happens.
2) Open the 'image' you downloaded in your favourite text editor, and see if it has any html code in it.

Try looking for a embed link that looks more like the one that I got and see if that works.
Title: Re: Downloading Images
Post by: Moru on 2011-Mar-26
Quote from: Omadan on 2011-Mar-26

If I paste the url http://www.photobucket.com/albums/v180/joepitto/jap7.png on the web browser it displays image perfectly too, meaning the url is okey too.  :S

If I try that link I get a "invalid url" message, I'm guessing this is a link to the image in your account, need to be logged in to see it or something like that. When you look at your account you should be able to find a something saying "public image link" or whatever, I'm no photobucket user :-)