- Home /
Downloading all images from given URL
Hello. I wonder, is it possible to download all images from some URL and store them... don't know, in array or something?
For any example code I'd prefer C#.
Here's the idea:
1. Enter URL - string url - Some kind of GUI or just predefined URL.
2. Check the URL (direct to image/html page)
2a. If only one image found (or direct link), save to variable - Texture2D img
2b. If more than one image found save 'em to array. - Texture2D[] array
3. Return result
It might be silly question, but I never actually used WWW class. Thanks for any answers.
Answer by Graham-Dunnett · Jun 27, 2014 at 08:28 PM
There is no html way to say "tell me all the images that live at a url". If the images are linked form an html page then you can read the html of that page and then find the img tags it contains, and fetch those images one at a time. (This is what a browser does to display you the page.)
I'm not searching for any HT$$anonymous$$L way. I'm only asking if is it possible to parse HT$$anonymous$$L file and check if there ARE ANY E$$anonymous$$BEDDED images using "" tag using Unity WWW class...
Or do I need $$anonymous$$ySQL n' PHP script to do it external way, then use GET/POST through Unity API?
Don't pretend like you don't know what I mean. I simplified the process, that's right, but still, that's not the point in the first place.
I hope it's clear enough.
"I'm not searching for any HT$$anonymous$$L way. I'm only asking if is it possible to parse HT$$anonymous$$L file and check if there ARE ANY E$$anonymous$$BEDDED images using "" tag using Unity WWW class..."
yes, it's possible.
"Don't pretend like you don't know what I mean. I simplified the process, that's right, but still, that's not the point in the first place."
don't pretend you actually asked HOW one would achieve this with unity's WWW
class. see, i can be sarcastic too ;)
graham was trying to answer your question - no need to take that tone with anyone trying to help you. it's not big or clever.
in answer to HOW one might achieve it:
the WWW class would return the page which can be parsed (bytes or a string, whichever you'd prefer, although some regex on the string would probably be easiest) to find image tags, which could then be loaded into your structure of choice (array, list, etc.)
pretty much as graham suggested...
you're welcome.
Your answer
Follow this Question
Related Questions
The name 'Joystick' does not denote a valid type ('not found') 2 Answers
Downloading all images from certain URL v2.0 0 Answers
Yield And Return 2 Answers
www class works fine in android but doesn't work in ios... 0 Answers
Getting info using WWW & PHP 3 Answers