PHP Classes

PHP Imager Scraper: Crawl a page and extract the images it contains

Recommend this page to a friend!
  Info   View files Example   Screenshots Screenshots   View files View files (24)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
Not enough user ratingsTotal: 183 This week: 1All time: 8,675 This week: 560Up
Version License PHP version Categories
imager-scraper 1.0Freely Distributable5Graphics, Files and Folders, Searching
Description 

Author

This package can crawl page and extract the images it contains.

It takes the URL of a given page and sends a HTTP request to retrieve the page contents.

The package can also parse the page using a DOM parser to find all the images it contains, so it can download those images to a separate directory.

Picture of santi
  Performance   Level  
Name: santi <contact>
Classes: 1 package by
Country: Spain Spain
Age: 37
All time rank: 4192114 in Spain Spain
Week rank: 411 Up13 in Spain Spain Up

Example

<?php
require_once('Imager.php');

$image = new Imager();

if(isset(
$_POST['url']))
 
$url = $_POST['url'];

if(isset(
$_POST['imgs']))
 
$image->download_images($_POST['imgs']);
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="">
<meta name="author" content="">
<link rel="shortcut icon" href="assets/images/favicon.png" sizes="32x32">
<title>Imager Scraper</title>
<link href="assets/css/bootstrap.css" rel="stylesheet">
<link href="assets/css/lightbox.css" rel="stylesheet">
<link href="assets/css/main.css" rel="stylesheet">
<link href='http://fonts.googleapis.com/css?family=Lato:300,400,900' rel='stylesheet' type='text/css'>
</head>

<body>

    <div class="loader">
      <img src="assets/images/loader.gif">
    </div>

    <!-- Fixed navbar -->
    <div class="navbar navbar-default navbar-fixed-top">
      <div class="container">
        <div class="navbar-header">
          <a class="navbar-brand" href="index.php"><b>Imager</b> Scraper</a>
        </div>
      </div>
    </div>
   
    <div class="container results-container" style="opacity: 0">
        <div class="row mt centered">
            <h1>Results <small class="num_results"></small></h1>
            <h3><b>url:</b> <a href="<?php echo $url; ?>" target="_blank"><?php echo $image->short_url($url); ?> <span class="glyphicon glyphicon-new-window"></span></a></h3>
            <div id="results">
          <div class="table-responsive">
            <table class="table table-striped table-bordered">
              <thead>
                <tr>
                  <th><span class="glyphicon glyphicon-search"></span></th>
                  <th>Width</th>
                  <th>Height</th>
                  <th>Extension</th>
                  <th>Image url</th>
                  <th>Preview</th>
                </tr>
              </thead>
              <tbody>
                <?php $image->get_images($url); ?>
</tbody>
            </table>
          </div>
            </div>
      <div class="clear"></div>
        </div><!-- /row -->
        <hr>
        <div class="row centered">
            <div class="col-lg-6 col-lg-offset-3">
        <form id="download_images" class="form-inline" role="form" method="post" action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]);?>">
          <div class="hidden-images"></div>
          <button type="submit" class="btn btn-primary btn-lg" style="display:none"><span class="glyphicon glyphicon-download"></span> Download all</button> <a href="index.php" class="btn btn-success btn-lg">Search New</a>
        </form>
            </div>
            <div class="col-lg-3"></div>
        </div><!-- /row -->
        <hr>
    </div><!-- /container -->
   
    <footer>
        <div class="container">
            <p class="centered"><?php echo date('Y') ?> <a href="index.php">Imager</a> | All right reserved</p>
        </div><!-- /container -->
    </footer>

  <?php require_once('includes/modal.php'); ?>

<script src="assets/js/jquery-1.10.2.min.js"></script>
<script src="assets/js/bootstrap.min.js"></script>
<script src="assets/js/lightbox.js"></script>
<script src="assets/js/main.js"></script>

</body>
</html>


Details

Imager

Download images from external website

Simple class that works with simple html dom parser. After adding an external url Imager the script will show all the images that it have found on the web.

Usage

For use run index.php on browser & include external url on input

History

Version 1.0 (2018-05-25)

Credits

Demo - http://barnaproject.com/projects/scraper/

Lead Developer - Barnaproject http://barnaproject.com

License

The MIT License (MIT)

Copyright (c) 2015 Chris Kibble

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.


Screenshots  
  • index
  • result
  Files folder image Files  
File Role Description
Files folder imageassets (4 directories)
Files folder imageincludes (2 files)
Plain text file Imager.php Class Class source
Accessible without login Plain text file index.php Aux. Auxiliary script
Accessible without login Plain text file LICENSE Lic. License text
Accessible without login Image file preview.png Data Auxiliary data
Accessible without login Plain text file README.md Doc. Documentation
Accessible without login Plain text file result.php Example Example script

  Files folder image Files  /  assets  
File Role Description
Files folder imagecss (3 files)
Files folder imagefonts (1 file)
Files folder imageimages (8 files)
Files folder imagejs (4 files)

  Files folder image Files  /  assets  /  css  
File Role Description
  Accessible without login Plain text file bootstrap.css Data Auxiliary data
  Accessible without login Plain text file lightbox.css Data Auxiliary data
  Accessible without login Plain text file main.css Data Auxiliary data

  Files folder image Files  /  assets  /  fonts  
File Role Description
  Accessible without login Plain text file glyphicons-halflings-regular.svg Data Auxiliary data

  Files folder image Files  /  assets  /  images  
File Role Description
  Accessible without login Image file close.png Icon Icon image
  Accessible without login Image file favicon.png Icon Icon image
  Accessible without login Image file ipad-hand.png Data Auxiliary data
  Accessible without login Image file loader.gif Data Auxiliary data
  Accessible without login Image file loading.gif Icon Icon image
  Accessible without login Image file next.png Icon Icon image
  Accessible without login Image file prev.png Icon Icon image
  Accessible without login Image file save-as.png Icon Icon image

  Files folder image Files  /  assets  /  js  
File Role Description
  Accessible without login Plain text file bootstrap.min.js Data Auxiliary data
  Accessible without login Plain text file jquery-1.10.2.min.js Data Auxiliary data
  Accessible without login Plain text file lightbox.js Data Auxiliary data
  Accessible without login Plain text file main.js Data Auxiliary data

  Files folder image Files  /  includes  
File Role Description
  Accessible without login Plain text file modal.php Aux. Auxiliary script
  Plain text file simple_html_dom.php Class Class source

 Version Control Unique User Downloads Download Rankings  
 92%
Total:183
This week:1
All time:8,675
This week:560Up