Used for get image from url and deliver cdn url

dev-master 2017-04-22 08:15 UTC


Is basic tools for crawl and save image in a web server. This php tools are written to use a web hosting with CDN.

This server provides a simple REST API. It indexes the files in mysql DB, but with Doctrine DBAL you are useful to use many different DB engine.


You can install ImgManager through Composer:

$ composer require fabgg/file_crawller

Then configure DB settings in DbManager.php in src directory.

public function __construct()
        $this->connectionParams = array(
            'dbname' => 'mydb',
            'user' => 'user',
            'password' => 'password',
            'host' => '',
            'driver' => 'pdo_mysql'

Add a database in your Mysql Server and excute modeldb.sql file

Your vhost document root must be configured to the web sub directory.


Add user in client db with oaut_id and oauth_secret better security with extra long string. Don't forget to add base_uri eg. https://cdn.domain.com/

The http header must contains :

content-type: application/json
id: myExtraLongStringInOauthId
secret myExtraLongStringInOauthSecret

url api/crawl

method POST

  • url : is the image file you want to crawl
  • process : (boolean) if true you need to provide a process_name eg. thumb in this case you must insert in db.client_parameters a row with name thumb and data a json string like

the answer will be like

    "id": "15",
    "mime": "image/jpeg",
    "url": "https://cdn.domain.com/img/681/546/576/660/235/30755615891-41a5128f20-b.jpg",
    "thumb": "https://cdn.domain.com/img/681/546/576/660/235/thumb_30755615891-41a5128f20-b.jpg"

url api/image/{id}

method GET you will receive the same answer as crawl. method DELETE for removing all files and db lines

Feel free to contibute Fabrice