title: Upload and display images on IPFS via nft.storage using javascript and php
body: <p>I'm trying to read an image file and upload to IPFS using nft.storage API.</p>
  <p>The code below works by converting the image to base64 string, but the nft.storage link only displays the string, not as an image as shown here -&gt; <a href="https://bafkreihxiweiopz4pfmqtub5klhsq7wuu7wrw24inbrozbl7cshd4uaqxq.ipfs.dweb.link/" rel="nofollow noreferrer">https://bafkreihxiweiopz4pfmqtub5klhsq7wuu7wrw24inbrozbl7cshd4uaqxq.ipfs.dweb.link/</a></p>
  <p>IF I decode the string, I could see the image. How to let IPFS display the image at the link?</p>
  <pre><code>&lt;?php
      // image to string conversion
      $imagelink = file_get_contents($image_original_path); 
    
      // image string data into base64 
      $encdata = base64_encode($imagelink);
  
  ?&gt;
  
  &lt;script&gt;
  document.getElementById(&quot;test&quot;).addEventListener(&quot;click&quot;, function() {
      
          jQuery.ajax({
              type: 'POST',
              url: 'https://api.nft.storage/upload',
              beforeSend: function(xhr) {
                  xhr.setRequestHeader(&quot;Authorization&quot;, &quot;Bearer eyJhbGciOiJIUzI1NiIsIn...&quot;)
              },
              mimeType: 'multipart/form-data', // this too
              contentType: &quot;image/png&quot;,
              cache: false,
              processData: false,
              data: &quot;&lt;?php echo $encdata; ?&gt;&quot;,
              success: function(data) {
                console.log(data);
                process the JSON data etc
              },
              error: function(data) {
                  console.log(data);
             } 
          });
  });
  &lt;/script&gt;
  </code></pre>