3

In HTML, I can insert an image from URL using the img tag and src attribute.

<img src="apple.jpg" />

But if my src contains a query string, then the browser displays a little broken image icon rather than the desired image. For example

<img src="http://fruitphotos.com/?type=apple" />

wouldn't work, even when that query returned an image file.

How can I insert image files returned from such queries?

krock
  • 31
  • 2
  • Not an ad or unresearched question. Have really struggled with this because I thought it was an HTML issue. I think what is happening is that the server (not the silly example server in the post, but the real server I'm working with) is returning the image file wrapped in a bare bones html document -- just enough to derail the HTML img tag. Looks like only an image in the browser. Apologies for any confusion in the question. – krock Sep 01 '16 at 00:49
  • You could try using an iframe to display the content instead (if it's returning an HTML document). It does look like this is a problem with the server and not your code. It's also possible that your browser or adblocker is stopping your site from displaying images from another domain name. – jkrei0 Dec 05 '22 at 22:34

0 Answers0