Crop

@param array $settings = []

@return GD
188891
public function crop(Array $settings = []) : GD
    {
        $sets = 
        [
            'x'      => $settings['x']      ?? $this->x      ?? 0,
            'y'      => $settings['y']      ?? $this->y      ?? 0,
            'width'  => $settings['width']  ?? $this->width  ?? 100,
            'height' => $settings['height'] ?? $this->height ?? 0,

        ];

        $this->canvas = imagecrop($this->canvas, $sets);

        $this->defaultRevolvingVariables();
        
        return $this;
    }
1330410
private function crop($file, array $coords, array $options)
    {
        if (isset($options['width']) && !isset($options['height'])) {
            $width = $options['width'];
            $height = $options['width'] * $coords['h'] / $coords['w'];
        } elseif (!isset($options['width']) && isset($options['height'])) {
            $width = $options['height'] * $coords['w'] / $coords['h'];
            $height = $options['height'];
        } elseif (isset($options['width']) && isset($options['height'])) {
            $width = $options['width'];
            $height = $options['height'];
        } else {
            $width = $coords['w'];
            $height = $coords['h'];
        }

        return Image::crop($file->tempName, $coords['w'], $coords['h'], [$coords['x'], $coords['y']])
            ->resize(new Box($width, $height));
    }
721382
public function loadSettings(array $settings)
    {
        $relationalManagerKey = $this->getOption(static::RELATIONAL_MANAGER_KEY);
        if (array_key_exists($relationalManagerKey, $settings)) {
            $this->registerEntityManagers((array) $settings[$relationalManagerKey]);
        }

        $mongoDBManagerKey = $this->getOption(static::MONGODB_MANAGER_KEY);
        if (array_key_exists($mongoDBManagerKey, $settings)) {
            $this->registerMongoDBDocumentManagers((array) $settings[$mongoDBManagerKey]);
        }

        $couchDBManagerKey = $this->getOption(static::COUCHDB_MANAGER_KEY);
        if (array_key_exists($couchDBManagerKey, $settings)) {
            $this->registerCouchDBDocumentManagers((array) $settings[$couchDBManagerKey]);
        }

        return $this;
    }
1090000
public function enqueue( $settings ) {
		$styles = $this->get_styles();

		if ( ! empty( $styles ) ) {
			$settings['styles'][] = [ 'css' => $styles ];
		}

		return $settings;
	}
416560
public function resize($source, Array $settings = []) : GD
    {
        $this->resample($source, $settings, 'imagecopyresized');

        return $this;
    }
789620
private function constructSettings($settings) {
        $ret = [];

        if(array_key_exists('fields', $settings)) {
            $ret['_source'] = ['include' => $settings['fields']];
        }

        if(array_key_exists('sort', $settings)) {
            $ret['sort'] = array_map(function($x) { return [$x[0] => ['order' => $x[1] ? 'asc':'desc']]; }, $settings['sort']);
        }

        $valid_keys = ['size'];
        foreach($valid_keys as $key) {
            if(array_key_exists($key, $settings)) {
                $ret[$key] = $settings[$key];
            }
        }

        return $ret;
    }
810152
public function set($settings) {

        if (!$this->simple) {
            if (is_a($this->source, 'ToolConsumer')) {
                $type = 'ToolProxy';
            } else if (is_a($this->source, 'ToolConsumer')) {
                $type = 'ToolProxyBinding';
            } else {
                $type = 'LtiLink';
            }
            $obj = new \stdClass();
            $obj->{'@context'} = 'http://purl.imsglobal.org/ctx/lti/v2/ToolSettings';
            $obj->{'@graph'} = array();
            $level = new \stdClass();
            $level->{'@type'} = $type;
            $level->{'@id'} = $this->endpoint;
            $level->{'custom'} = $settings;
            $obj->{'@graph'}[] = $level;
            $body = json_encode($obj);
        } else {
            $body = json_encode($settings);
        }

        $response = parent::send('PUT', null, $body);

        return $response->ok;

    }
203733
protected function addModelSettings(array &$settings)
    {
        $empty = [];
        $multi = explode(parent::FIELD_SEP, $this->_fieldDefinition['gtf_field_values']);
        if (empty($this->_fieldDefinition['gtf_field_values']) || empty($multi)) {
            $multi = $this->util->getTranslated()->getYesNo();
        }

        if ($this->_fieldDefinition['gtf_required'] !== 1) {
            $empty = $this->util->getTranslated()->getEmptyDropdownArray();
        }

        $settings['elementClass'] = 'Radio';
        $settings['separator'] = ' ';
        $settings['multiOptions'] = $empty + array_combine($this->keyValues, array_slice($multi, 0, 2));
        if ($this->_fieldDefinition['gtf_field_default'] !== null) {
            $settings['default'] = (int)$this->_fieldDefinition['gtf_field_default'];
        }
    }
801645
private function applyFilters(array $settings): array
    {
        $where = [];
        foreach ($settings as $column => $filters) {
            foreach ($filters as $filter => $value) {
                if ($filter === Grid\Grid::FILTER_LIKE) {
                    $value = '%' . $value . '%';
                }
                $where[] = $column . ' ' .
                    $this->filters[$filter] . ' ' .
                    Proxy\Db::quote((string)$value);
            }
        }
        return $where;
    }
347993
protected function removeDots(array $settings): array
    {
        $conf = [];
        foreach ($settings as $key => $value) {
            $conf[$this->removeDotAtTheEnd($key)] = \is_array($value) ? $this->removeDots($value) : $value;
        }
        return $conf;
    }
424503
public function resize($crop = false)
    {
        if ($crop) {
            return $this->resizeCrop();
        } else {
            $sourceDimension = $this->sourceImageFile->getDimension();
            $resampleDimension = $this->resampleImageFile->getDimension();

            if (($sourceDimension->getWidth() <= $resampleDimension->getWidth()) && ($sourceDimension->getHeight() <= $resampleDimension->getHeight())) {
                return true;
            } //no resizing needed

            //try max width first...
            $resizeRatio = $resampleDimension->getWidth() / $sourceDimension->getWidth();
            $resizeWidth = $resampleDimension->getWidth();
            $resizeHeight = $sourceDimension->getHeight() * $resizeRatio;

            //if that didn't work
            if ($resizeHeight > $resampleDimension->getHeight()) {
                $resizeRatio = $resampleDimension->getHeight() / $sourceDimension->getHeight();
                $resizeHeight = $resampleDimension->getHeight();
                $resizeWidth = $sourceDimension->getWidth() * $resizeRatio;
            }

            $resampleImageResource =& $this->getResampleImageResource();

            return $resampleImageResource->resizeImage(
                $resizeWidth,
                $resizeHeight,
                \Imagick::FILTER_CATROM, 0.9, true);
        }
    }
191238
public function polygon(Array $settings = []) : GD
    {
        $points     = $settings['points']     ?? $this->points     ?? 0;
        $pointCount = $settings['pointCount'] ?? $this->pointCount ?? (ceil(count($this->points ?? $points) / 2));
        $color      = $settings['color']      ?? $this->color      ?? '0|0|0';
        $style      = $settings['type']       ?? $this->type       ?? NULL;

        if( $style === NULL )
        {
            imagepolygon($this->canvas, $points, $pointCount, $this->allocate($color));
        }
        else
        {
            imagefilledpolygon($this->canvas, $points, $pointCount, $this->allocate($color));
        }

        $this->defaultRevolvingVariables();

        return $this;
    }
463169
public function crop($width = null, $height = null, $options = null)
    {
        $this->config = [
            'width'   => $width,
            'height'  => $height,
            'options' => $options,
        ];

        return $this;
    }
247941
public function setSettings(array $settings): SettingsRepositoryInterface
    {
        $this->parseCompatibleSettings($settings);
        $this->settings = $settings;

        return $this;
    }
1370254
public function resolve(array $settings = [])
    {
        return (new Configuration())->newDefaultAnnotationDriver(
            Arr::get($settings, 'paths', []),
            Arr::get($settings, 'simple', false)
        );
    }
528322
public function formatStackOperationOptions(array $settings)
    {
        $data = [];

        foreach ($settings as $name => $value) {
            $data[] = $name.':'.$value;
        }

        return implode(' | ', $data);
    }
66668
public function setSettings(array $settings)
    {
        $this->settings = array_merge($this->settings, $settings);
        
        if (isset($settings['templates_path'])) {
            $this->view->templatesPath = $this->settings['templates_path'];
        }
        
        return $this;
    }