Make thumbnail image
@param array $params
193062
private function thumbnail(array $params)
    {
        $mode = isset($params['mode']) ? $params['mode'] : self::THUMBNAIL_OUTBOUND;

        $width = (isset($params['width']) && is_numeric($params['width'])) ? $params['width'] : null;
        $height = (isset($params['height']) && is_numeric($params['height'])) ? $params['height'] : null;

        if (is_null($width) || is_null($height)) {
            throw new Exception('Wrong thumbnail width or height');
        }

        $this->image = $this->image->thumbnail(new Box($width, $height), $mode);
    }
158356
public function createStreamFromArray(array $params)
    {
        $string = "";
        foreach ($params as $key => $value) {
            $string .= $key . '=' . urlencode(trim($value)) . '&';
        }

        $string = rtrim($string, "&");

        return $this->createStream($string);
    }
502585
public function prepare($params)
    {
        $this->params = !empty($params) ? $params[ 0 ] : [ ];

        // force mandatory fields
        $this->filter();
        $this->maxRecords();
    }
90339
public function enregistrerOrdresEtapes($params = array())
    {
        $imObj      = new imageObject();
        $ordreArray = $imObj->getArrayFromPostDragAndDrop();
        $i          = 1;
        foreach ($ordreArray as $indice=>$idEtape) {

            // l'indice commence a 1 
            $reqUpdate = "UPDATE etapesParcoursArt SET position='".$i."' WHERE idEtape='".$idEtape."'";
            $resUpdate = $this->connexionBdd->requete($reqUpdate);
            $i++;
        }
    }
1105518
public static function apply($imageInstance, $params)
    {
        if (ImagerService::$imageDriver === 'gd') {
            $color = $imageInstance->palette()->color($params);
            $imageInstance->effects()->colorize($color);
        }

        if (ImagerService::$imageDriver === 'imagick') {
            /** @var ImagickImage $imageInstance */
            $imagickInstance = $imageInstance->getImagick();
            /** @var RGB $color */
            $color = $imageInstance->palette()->color($params);
            $imagickInstance->colorizeImage((string)$color, new \ImagickPixel(sprintf('rgba(%d, %d, %d, 1)', $color->getRed(), $color->getGreen(), $color->getBlue())));        
        }
    }
461901
private function fixParams(array $params)
    {
        $qualityOverride = false;

        foreach ($params as $key => $value) {
            if ($key === 'xmethod') {
                $params['method'] = $value;
                unset($params['xmethod']);
            } elseif ($key === 'backgroundcolor' && !preg_match('/^\#[0-9A-Za-z]{6}$/', $value)) {
                $params['backgroundcolor'] = '';
            } elseif ($key === 'compression') {
                if (!$qualityOverride) {
                    $params['quality'] = 0;
                }
                $params['quality'] = $params['quality'] + $value * 10;
                $qualityOverride = true;
                unset($params['compression']);
            } elseif ($key === 'filtertype') {
                if (!$qualityOverride) {
                    $params['quality'] = 0;
                }
                $params['quality'] = $params['quality'] + $value;
                $qualityOverride = true;
                unset($params['filtertype']);
            }
        }

        return $params;
    }
758806
public function makeThumbnail($prefix, array $config)
    {
        $defaultConfig = [
            'jpeg_quality' => 100
        ];
        $config = array_merge($defaultConfig, $config);

        $width = !empty($config['w']) ? $config['w'] : null;
        $height = !empty($config['h']) ? $config['h'] : null;

        $image = $this->ImageManager->make($this->Path->fullPath());

        if (!empty($config['orientate'])) {
            $image = $this->orientate($image);
        }

        if (!empty($config['crop'])) {
            $image = $this->thumbnailCrop($image, $width, $height);
        } elseif (!empty($config['fit'])) {
            $image = $this->thumbnailFit($image, $width, $height);
        } elseif (!empty($config['custom'])) {
            $image = $this->thumbnailCustom($image, $config['custom'], $config['params']);
        } else {
            $image = $this->thumbnailResize($image, $width, $height);
        }

        unset($config['crop'], $config['w'], $config['h'], $config['custom'], $config['params'], $config['orientate']);

        $image->save($this->Path->fullPath($prefix), $config['jpeg_quality']);

        return $this->Path->fullPath($prefix);
    }
365455
public static function submit($params = array()) {

        if( !is_array($params) )
        {
            throw new \InvalidArgumentException("Arguments is not a Array". print_r($params, true));
        }

        $o = '<input type="submit"';
        $o .= (isset($params['id'])) ? " id='{$params['id']}'" : '';
        $o .= (isset($params['name'])) ? " name='{$params['name']}'" : '';
        $o .= (isset($params['class'])) ? " class='{$params['class']}'" : '';
        $o .= (isset($params['onclick'])) ? " onclick='{$params['onclick']}'" : '';
        $o .= (isset($params['value'])) ? " value='{$params['value']}'" : '';
        $o .= (isset($params['disabled'])) ? " disabled='{$params['disabled']}'" : '';
        $o .= (isset($params['style'])) ? " style='{$params['style']}'" : '';
        $o .= " />\n";
        return $o;
    }
1108532
protected function makeUrl( array$params ):string
	{
		$url= $this->url;

		foreach( $params['path']??[] as $key=>$value )
		{
			$url= str_replace( "{{$key}}", $value, $url );
		}

		if( $params['query']??null )
		{
			$url.= '?'.http_build_query( $params['query'] );
		}

		return $url;
	}
1227764
public function setAppDefinedData(array $params)
    {
        $items = [];
        foreach ($params as $key => $value) {
            $items[] = ['Tag' => $key, 'Value' => $value];
        }
        $this->items['AppDefinedData'] = $items;
        return $this;
    }
759520
public function push($params)
    {
        foreach ($params as $key => $value) {
            array_set($this->params, $key, $value);
        }
        return $this;
    }
45014
public function write($text, $params=array())
    {
        $color = (isset($params['color'])) ?  $params['color'] : array(0, 0, 0);
        $color = imagecolorallocate($this->edited, $color[0], $color[1], $color[2]);
        $size = (isset($params['size']))? $params['size'] : 5;
        $x = (isset($params['x']))? $params['x'] : 2;
        $y = (isset($params['y']))? $params['y'] : 2;


        imagestring($this->edited, $size, $x, $y, $text, $color);
    }
1194760
public function rename($params, $optParams = [])
    {
        return $this->sendRequest(['cloudId', 'publicId', 'newPublicId'], [
            'restAction' => 'update',
            'uri' => '/c/<cloudId>/o/<publicId>/rename/o/<newPublicId>',
            'params' => $params,
            'getParams' => $optParams,
        ], function ($response) use ($params) {
            if ($response->data && !isset($response->data['cloudId'])) {
                $response->data['cloudId'] = $this->client->getParam($params, 'cloudId');
            }

            return isset($response->data) ? new Image($response->data) : $response;
        });
    }
430714
public function outputImage($path, array $params)
    {
        $path = $this->makeImage($path, $params);

        header('Content-Type:'.$this->cache->getMimetype($path));
        header('Content-Length:'.$this->cache->getSize($path));
        header('Cache-Control:'.'max-age=31536000, public');
        header('Expires:'.date_create('+1 years')->format('D, d M Y H:i:s').' GMT');

        $stream = $this->cache->readStream($path);

        if (ftell($stream) !== 0) {
            rewind($stream);
        }
        fpassthru($stream);
        fclose($stream);
    }
471132
public function withPost(array $params)
    {
        $request = $this;
        if ($this->isJson()) {
            $body = json_encode($params);
        } else {
            $body = http_build_query($params);
            if (!$this->hasHeader('Content-Type')) {
                $request = $this->withHeader('Content-Type', 'application/x-www-form-urlencoded');
            }
        }

        return new self(
            $request->getMethod(),
            $request->getUri(),
            $request->getHeaders(),
            $body,
            $request->getProtocolVersion(),
            $request->getRetries(),
            $request->getOptions(),
            $this->getServiceKey(),
            $this->getRequestKey()
        );
    }
147863
protected function buildThumbnails($files)
    {
        $thumbnails = [];

        foreach ($files as $file) {
            if (file_can_have_thumbnail($file)) {
                $thumbnails[$file] = (string) $this->image
                    ->make(Storage::get($file))
                    ->resize(20, 20)->encode('data-url');
            }
        }

        return $thumbnails;
    }
1279962
private function createJsonBody(array $params)
    {
        return (0 === \count($params)) ? null : \json_encode($params, empty($params) ? \JSON_FORCE_OBJECT : 0);
    }