title: Can't Display an image from google drive on a dialog or sidebar using google apps script
body: <p>I have a script that I'm working on to learn more about the structure of Google Docs. It displays a lot of the structure I'm trying learn about in a sidebar.  But I've been trying to display an image that is in this Google Doc that my script is contained in but it seems that no matter what I try I can't display the image thats already in Google Docs.  So I uploaded another version of it to Google Drive and tried using Google Links as described in several StackOverFlow references but they just don't seem to be working.  The only thing that seems to work reliably is to upload it to my website and use the url from that. Here's the snippet that's giving me the problems.</p>
  
  <pre><code>var br = '&lt;br /&gt;';
  var images=DocumentApp.getActiveDocument().getBody().getImages();
    if(images)
    {
      s+=br + '&lt;strong&gt;Body Images&lt;/strong&gt;' + br + '&lt;strong&gt;Number of Images: &lt;/strong&gt; ' + images.length;
      for(var i=0;i&lt;images.length;i++)
      {
        s+=br + '&lt;img src="http://myWebsite.com/GmailSignature.png" width="100"/&gt;'; //This is the only thing I can get to work
        s+=br + '&lt;img src="https://drive.google.com/open?id=0Bx2ds1-xxxxxxxxxxxxxxxxxxxx" width="100"/&gt;';//There's several references on StackOverFlow.com that say this should work
        s+=br + '&lt;img src="https://drive.google.com/uc?id=0Bx2ds1-xxxxxxxxxxxxxxxxxxxx&amp;export=download" width="100" /&gt;';
      }
    }else{s+=br + '&lt;strong&gt;No Images in this Body element.&lt;/strong&gt;';}
  </code></pre>
  
  <p>He's what my sidebar looks like with this code:</p>
  
  <p><a href="https://i.stack.imgur.com/L50tw.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/L50tw.jpg" alt="enter image description here"></a></p>
  
  <p>The link from my website works.  The link from Google Drive does not.  I just added that image to one of my google sites and took that url and that works as well.  One of stackoverflow references suggest this <code>&lt;img src='https://drive.google.com/uc?id=" + imageId +'"'</code> but what appears to be working for me is to turn that into this: <code>&lt;img src='https://drive.google.com/uc?id="' + imageId + '&amp;export=download" /&gt;'</code>.</p>
  
  <p>Currently the only solution I have is to insert the image onto one of my google sites(old style).  Save the page and get the url with developer and that works every time.  I'm hoping there is or atleast will be in the future a simpler method.  In this situation, it would be preferable to be able to use the image directly out of the Google Docs Document.</p>