dev-master
9999999-dev https://github.com/DJStarCOM/hexa-composer-test-packageHexa test package for image download
MIT
The Requires
- php >=5.6.0
- ext-gd *
Hexa test package for image download
It requires PHP 5.6 or newer and is licensed under the MIT License. Install it via Composer:, (*1)
php composer.phar require djstarcom/hexa-composer-test-package
Create object and set the images storage path, (*2)
$imageDownloader = new ImageDownloader('/tmp');
Set allowed mime types, (*3)
$imageDownloader->setAllowedImagesMimeTypes([ 'png' => 'image/png', 'jpg' => 'image/jpeg', 'gif' => 'image/gif', ]);
Download a remote image, (*4)
$imageDownloader->downloadRemoteImage('https://assets-cdn.github.com/images/modules/about/about-header.jpg');
or, (*5)
$imageDownloader->addRemoteImageUrl('https://assets-cdn.github.com/images/modules/about/about-header.jpg'); $imageDownloader->downloadRemoteImages();
Also available download multiple images., (*6)
$imageDownloader->addRemoteImageUrl([ 'https://assets-cdn.github.com/images/modules/about/about-header.jpg', 'http://cdn.shopify.com/s/files/1/0051/4802/products/sticker-large_1024x1024.jpg', ]); $imageDownloader->downloadRemoteImages();
To get array of all errors during the script execution, (*7)
$errors = $imageDownloader->getErrors();
or receive array of all stored images, (*8)
$all_stored_images = $imageDownloader->getStoredImages();
Hexa test package for image download
MIT