title: How to download images saved on the DB in html
body: <p>My code is basically this... If there was a functionality like &quot;controls&quot; for video tag, would be awesome, but there isn't. I do not know to mae a button or icon, etc, to download the image. I also tried  Download Link , but it does not work because the image is not static on a file, but dymanically saved on the DB.
  I just need a download button/icon to download the actual image being displayed.</p>
  <pre><code>          &lt;!-- album starts --&gt;
               
            &lt;div class=&quot;full-img&quot; id=&quot;fullImgBox&quot;&gt;
  
                &lt;img src=&quot;images/img1.jpg&quot; id=&quot;fullImg&quot; controls class=&quot;media&quot;&gt;
                &lt;span class=&quot;material-icons&quot; onclick=&quot;closeFullImg()&quot;&gt;close&lt;/span&gt;
            &lt;/div&gt;
            &lt;div class=&quot;img-gallery&quot;&gt;
            &lt;?php if(count($posts) !== 0) { ?&gt;
  
                &lt;?php foreach($posts as $post) { 
                  if( $post['post_type'] == &quot;image&quot;){
                ?&gt;
                  &lt;img src=&quot;&lt;?= POSTS_SAVED_TO.$post['uploaded_file_name'] ?&gt;&quot; onclick=&quot;openFullImg(this.src)&quot;/&gt;
                &lt;?php
                  }
                } 
             } else { ?&gt; 
            &lt;p class=&quot;alert alert-info&quot;&gt;No Posts are made yet !!.&lt;/p&gt;
            &lt;?php } ?&gt;
            &lt;/div&gt;
  
            &lt;script&gt;
  
                var fullImgBox = document.getElementById(&quot;fullImgBox&quot;);
                var fullImg = document.getElementById(&quot;fullImg&quot;);
  
                function openFullImg(pic) {
                    fullImgBox.style.display = &quot;flex&quot;;
                    fullImg.src = pic;
                }
  
                function closeFullImg() {
                    fullImgBox.style.display = &quot;none&quot;;
                }
  
            &lt;/script&gt;
  </code></pre>