PHP code example of guisaldanha / image-downloader

1. Go to this page and download the library: Download guisaldanha/image-downloader library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

guisaldanha / image-downloader example snippets




uiSaldanha\ImageDownloader\ImageDownloader;

set_time_limit(0);

$alvo = 'https://blog-de-exemplo.com/imagens-da-categoria.html';
$downloader = new  ImageDownloader($alvo, __DIR__.'/imagens-baixadas',true);
$imagens = $downloader->download();

foreach($imagens  as  $imagem){
$imagem = str_replace(__DIR__.'/', '', $imagem);
    echo  '<img src="'.$imagem.'" style="width:100px; height:100px; margin:10px;">';
}