<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Binary to image in Dropbox API Support &amp; Feedback</title>
    <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Binary-to-image/m-p/264579#M15500</link>
    <description>&lt;P&gt;I believe you can just do something like this instead:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;dbx.filesDownload({path: '/test.jpg'})
  .then(function(response) {
    var fileUrl = URL.createObjectURL(response.fileBlob);
    var img = document.createElement('img');
    img.setAttribute('src', fileUrl);
    document.getElementById('results').appendChild(img);
  })
  .catch(function(error) {
    console.error(error);
  });&lt;/PRE&gt;</description>
    <pubDate>Mon, 12 Feb 2018 16:30:43 GMT</pubDate>
    <dc:creator>Greg-DB</dc:creator>
    <dc:date>2018-02-12T16:30:43Z</dc:date>
    <item>
      <title>Binary to image</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Binary-to-image/m-p/264555#M15494</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;filesDownload or&amp;nbsp;filesGetThumbnail returns object with&amp;nbsp;fileBinary property. I can't in any way I tried convert that data to image.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Most of the time I get this exception&lt;/SPAN&gt;&lt;/P&gt;
&lt;PRE&gt;DOMException: Failed to execute 'btoa' on 'Window': The string to be encoded contains characters outside of the Latin1 range.&lt;/PRE&gt;
&lt;P&gt;&lt;SPAN&gt;Unless I do this&lt;/SPAN&gt;&lt;/P&gt;
&lt;PRE&gt;...
img.src='data&amp;amp;colon;image/jpeg;base64,' + window.btoa(unescape(encodeURIComponent(response.data.fileBinary)));
...&lt;/PRE&gt;
&lt;P&gt;&lt;SPAN&gt;But again it is unreadable&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;And here is screenshot of original fileBinary data and converted data with code above&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screenshot from 2018-02-11 00.15.13.png" style="width: 999px;"&gt;&lt;img src="https://www.dropboxforum.com/t5/image/serverpage/image-id/2360i154DF55DAFF6B569/image-size/large?v=v2&amp;amp;px=999" role="button" title="Screenshot from 2018-02-11 00.15.13.png" alt="Screenshot from 2018-02-11 00.15.13.png" /&gt;&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Any kind of solution would be nice &lt;img class="lia-deferred-image lia-image-emoji" src="https://www.dropboxforum.com/html/@13532C4C3505179FBF012F1C117AE2EB/emoticons/1f604.png" alt=":grinning_face_with_smiling_eyes:" title=":grinning_face_with_smiling_eyes:" /&gt; thank you!&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 29 May 2019 09:15:27 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Binary-to-image/m-p/264555#M15494</guid>
      <dc:creator>vildantursic</dc:creator>
      <dc:date>2019-05-29T09:15:27Z</dc:date>
    </item>
    <item>
      <title>Re: Binary to image</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Binary-to-image/m-p/264579#M15500</link>
      <description>&lt;P&gt;I believe you can just do something like this instead:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;dbx.filesDownload({path: '/test.jpg'})
  .then(function(response) {
    var fileUrl = URL.createObjectURL(response.fileBlob);
    var img = document.createElement('img');
    img.setAttribute('src', fileUrl);
    document.getElementById('results').appendChild(img);
  })
  .catch(function(error) {
    console.error(error);
  });&lt;/PRE&gt;</description>
      <pubDate>Mon, 12 Feb 2018 16:30:43 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Binary-to-image/m-p/264579#M15500</guid>
      <dc:creator>Greg-DB</dc:creator>
      <dc:date>2018-02-12T16:30:43Z</dc:date>
    </item>
  </channel>
</rss>

