按唯一网址下载图片。

I have a div class for an image search button:

<div class="form-group">
    <button onclick="myFunction()">Click me</button>
    <p id="demo"></p>
    <script>
        var link = "https://source.unsplash.com/all/?";
        var articleTitle = "<?php echo "'" . $article->title . "'"; ?>";
        function myFunction() {
            var d = new Date();
            var c = link + articleTitle + "[" + d.getTime()+"]";
            document.getElementById("demo").innerHTML = "<img src=" + c + " height='100' width='100'/>" ;
        }
    </script>
</div>

Each click on this button gives me a new image by my keyword ($article->title) with a unique http url.

The question is: How can I make an insert button which will download the chosen image on my server because then I want to insert that picture into my article.