PHP code example of pomirleanu / image-colors
1. Go to this page and download the library: Download pomirleanu/image-colors 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/ */
pomirleanu / image-colors example snippets
php
Pomirleanu\ImageColors\ImageColorsServiceProvider::class,
php
namespace ****;
use Illuminate\Http\Request;
use Pomirleanu\ImageColors;
class ImageClass
{
/**
* @var ImageColors
*/
private $imageColors;
/**
* ImagesController constructor.
* @param ImageColors $imageColors
*/
public function __construct(ImageColors $imageColors)
{
$this->imageColors = $imageColors;
}
public function getColors(Request $request){
if ($request->hasFile('image')) {
$colors = $this->imageColors->get($request->image);
//Do what you want with the colors
}
}
}