0

I have an application that loads an image - the URL of the image however is dynamically generated.

The image URL would look like this (I get the image name through their API): http://openweathermap.org/img/w/10d.png

That URL is created in javascript - how would I make javascript actually get the image from that URL and return the .png so I could display it?

Would ajax be best for this? The solution would have be in regular javascript as the application displaying the image only allows for basic javascript.

Edit: This is for a digital signage solution - so I need to get the .png file into javascript where I will return ThePicture so the signage can display it appropriately. So unfortunately, just adding it to the/a DOM won't work.

13
  • Possible duplicate of How to display dynamic url image in html from which created by javascript Commented Jun 15, 2017 at 15:22
  • It is not a duplicate because I don't need to insert it into a dom - I need to somehow get the image object - it's a digital signage solution, so I'm not displaying to a webpage (unfortunately). Commented Jun 15, 2017 at 15:24
  • Then Ajax would be useless … since that is a buzzword meaning "Making an HTTP request from a webpage without leaving the page." Commented Jun 15, 2017 at 15:24
  • Are you saying that you want to create an actual Image() Object then? Commented Jun 15, 2017 at 15:25
  • 2
    @Hanny — You need to tell us about the JS environment you are running in. "Unspecified digital signage solution" isn't enough to go on. Commented Jun 15, 2017 at 15:30

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.