Sunucuya indiriyordu. Bu kodu kullanın, biraz uzun olabilir ama çalışıyor.
if (isset($_POST['indir'])) {
    function grab_image($url,$saveto){
        $ch = curl_init ($url);
        curl_setopt($ch, CURLOPT_HEADER, 0);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
        curl_setopt($ch, CURLOPT_BINARYTRANSFER,1);
        $raw=curl_exec($ch);
        curl_close ($ch);
        if(file_exists($saveto)){
            unlink($saveto);
        }
        $fp = fopen($saveto,'x');
        fwrite($fp, $raw);
        fclose($fp);
    }
    $name = time();
    grab_image('https://instagram.fada1-8.fna.fbcdn.net/v/t51.2885-19/s320x320/59381178_2348911458724961_5863612957363011584_n.jpg?_nc_ht=instagram.fada1-8.fna.fbcdn.net&_nc_ohc=O_2E-RAl6mQAX__dp_C&oh=060106f8edf99d36efb1dc36dc737636&oe=5EC8605B', $name.'.jpg');
    echo $name.'.jpg';
    exit();
}
if (isset($_POST['sil'])) {
    unlink($_POST['sil']);
    exit();
}
?>
    
    
    
    
    Resim indirme
<script></script>
<script>
    $(".indir").on("click", function () {
        let src = $(this).data("src");
        $.post(window.location, {indir: src}, function (response) {
            let a = document.createElement('a');
            a.href = response;
            a.download = response;
            document.body.appendChild(a);
            a.click();
            document.body.removeChild(a);
            $.post(window.location, {sil: response});
        })
    })
</script>