Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You don't need to request image data via AJAX and then manipulate it yourself, in order to display it. Just use an <code>&lt;img&gt;</code> tag!</p> <p>If <code>/my_url</code> is the location of your image, then</p> <pre><code>&lt;img src="/my-url" alt="Appropriate description"/&gt; </code></pre> <p>would do it. NOTE: <code>/my-url</code> doesn't have to be an <em>actual</em> image. It can be any resource (including a servlet) that returns image data with the appropriate MIME type set.</p> <p>If you want to create the tag dynamically, you can use your favourite library, or do it iwth native JS:</p> <pre><code>var oImg=document.createElement("img"); oImg.setAttribute('src', '/my-url'); oImg.setAttribute('alt', 'Appropriate description'); oImg.setAttribute('height', imgHeight); oImg.setAttribute('width', imgWidth); document.body.appendChild(oImg); </code></pre> <h2>Edit</h2> <p>If you want to be doing this server-side (and if so, is this really AJAX?), then you might want to look at the <a href="http://en.wikipedia.org/wiki/Data_URI_scheme" rel="nofollow">data uri scheme</a>.</p> <p>With this scheme, you can data directly to an image tag, without needing to provide it with an HTTP resource. To use this, you convert your outputstream to base64 and use the following:</p> <pre><code>&lt;img src="data:image/png;base64,converted-data-stream-goes-here..." alt="Who needs HTTP?"/&gt; </code></pre> <p>The <code>image/png</code> would change depending on the MIME type of your source data.</p> <p>Read the linked Wikipedia page to fully understand the trade-offs here.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload