Asserts the configuration of image effects.

@Then exactly the following image effects should exist

@throws \Exception
494638
public function assertImageEffects(TableNode $expected) {
    $image_style_info = [];
    foreach ($this->getImageStyles() as $image_style) {
      foreach ($image_style->getEffects() as $effect) {
        $image_style_info[] = [
          $image_style->label(),
          (string) $effect->label(),
          $this->formatImageEffectSummary($effect->getSummary()),
        ];
      }
    }
    $actual = new TableNode($image_style_info);

    (new TableEqualityAssertion($expected, $actual))
      ->expectHeader([
        'Image style',
        'Effect',
        'Summary',
      ])
      ->setMissingRowsLabel(self::missingRowsLabelFor('workflow'))
      ->setUnexpectedRowsLabel(self::unexpectedRowsLabelFor('workflow'))
      ->assert();
  }
906165
protected function initialize()
    {
        $info         = getimagesize($this->path);
        $this->width  = $info[0];
        $this->height = $info[1];
        $this->pixels = $this->width * $this->height;
        $type         = $info[2];

        switch ($type) {
            case IMAGETYPE_JPEG:
                $this->image = imagecreatefromjpeg($this->path);
                break;
            case IMAGETYPE_GIF;
                $this->image = imagecreatefromgif($this->path);
                break;
            case IMAGETYPE_PNG;
                $this->image = imagecreatefrompng($this->path);
                break;
            default:
                throw new \RuntimeException('Unsupport image type ' . $type);
        }

        imagealphablending($this->image, false);
    }
1368599
public function configure()
    {
        $configurator = $this->configurator;
        if (!($configurator instanceof ElFinderConfigurationProviderInterface)) {
            throw new \Exception('Configurator class must implement ElFinderConfigurationProviderInterface');
        }
        $parameters = $configurator->getConfiguration($this->instance);

        return $parameters;
    }
882315
public function initChunks()
    {
        if (!$this->template) {
            throw new Exception(['Lister does not have default template. Either supply your own HTML or use "defaultTemplate"=>"lister.html"']);
        }

        // empty row template
        if ($this->template->hasTag('empty')) {
            $this->t_empty = $this->template->cloneRegion('empty');
            $this->template->del('empty');
        }

        // data row template
        if ($this->template->hasTag('row')) {
            $this->t_row = $this->template->cloneRegion('row');
            $this->template->del('rows');
        } else {
            $this->t_row = clone $this->template;
            $this->template->del('_top');
        }
    }
994279
public function apply($resource){
		// Get resolution
		$width=imagesx($resource);
		$height=imagesy($resource);
		if($width===false || $height===false){
			throw new Exception("An error was encountered while getting image resolution");
		}
		// Image conversion
		$new=imagecreatetruecolor($width,$height);
		if(!imagecopy($new,$resource,0,0,0,0,$width,$height)){
			throw new Exception("An error was encountered while copying image");
		}
		return $new;
	}
355769
public function createCopy(): AbstractResize
    {
        $this->createCanvas();

        $this->intermediate['copy'] = imagecreatefrompng($this->source['path'] . $this->source['file']);
        if ($this->intermediate['copy'] === false) {
            throw new \Exception('Call to imagecreatefrompng failed');
        }

        $this->resampleCopy();

        return $this;
    }
245441
protected function loadImageResource()
    {
        if(empty($this->resource))
        {
            if((is_null($this->worker) || $this->worker === $this::WORKER_IMAGICK) && $this->imagickAvailable())
            {
                $this->resource = $this->createImagick($this->image);
            }
            elseif((is_null($this->worker) || $this->worker === $this::WORKER_GD) && $this->gdAvailable())
            {
                $this->resource = $this->getGdResource($this->image);
            }
            else
            {
                throw new Exception('Required extensions missing, extension GD or Imagick is required');
            }
        }
    }
182933
public function grayscale()
	{
		if ( $this->test() )
		{
			if ( class_exists('\\Imagick') )
			{
				if ( !$this->img->modulateImage(100,0,100) ){
					$this->error = \defined('BBN_THERE_HAS_BEEN_A_PROBLEM') ?
						BBN_THERE_HAS_BEEN_A_PROBLEM : 'There has been a problem';
				}
			}
			else if ( function_exists('imagefilter') )
			{
				if ( !imagefilter($this->img,IMG_FILTER_GRAYSCALE) ){
					$this->error = \defined('BBN_THERE_HAS_BEEN_A_PROBLEM') ?
						BBN_THERE_HAS_BEEN_A_PROBLEM : 'There has been a problem';
				}
			}
		}
		return $this;
	}
748035
public function run()
	{
		if(self::checkRequirements('imagick') || self::checkRequirements('gd'))
		{
			$this->renderImage();
			$this->registerClientScript();
		}
		else
			throw new CException(Yii::t('yii','GD with FreeType or ImageMagick PHP extensions are required.'));
	}
1153420
public function exists()
    {
        try {
            $result = $this->getSoapClient()->ImageExists(array(
                'filename' => basename($this->filename) ,
            ));

            return ( boolean ) $result->ImageExistsResult;
        } catch ( SoapException $e ) {
            throw new StatusException('Error while verifying existence of the image' , $e);
        }
    }
856050
private function createImageResource()
    {
        // We are currently using vips_image_new_from_file(), but we could consider
        // calling vips_jpegload / vips_pngload instead
        $result = /** @scrutinizer ignore-call */ vips_image_new_from_file($this->source, []);
        if ($result === -1) {
            /*throw new ConversionFailedException(
                'Failed creating new vips image from file: ' . $this->source
            );*/
            $message = /** @scrutinizer ignore-call */ vips_error_buffer();
            throw new ConversionFailedException($message);
        }

        if (!is_array($result)) {
            throw new ConversionFailedException(
                'vips_image_new_from_file did not return an array, which we expected'
            );
        }

        if (count($result) != 1) {
            throw new ConversionFailedException(
                'vips_image_new_from_file did not return an array of length 1 as we expected ' .
                '- length was: ' . count($result)
            );
        }

        $im = array_shift($result);
        return $im;
    }
677276
public function process()
    {
        parent::process();

        $cmd = $this->compile();
        $this->runCmd(
            $cmd,
            '\Thapp\JitImage\Exception\ImageProcessException',
            function ($stderr) {
                $this->clean();
            },
            ['#', PHP_EOL]
        );
    }
125309
protected function recreateImageSizes(Image $file)
	{
		if ( ! $file instanceof Image) {
			throw new Exception\RuntimeException('Image entity expected');
		}

		$sizes = $file->getImageSizeCollection();
		if ( ! $sizes->isEmpty()) {
			foreach ($sizes as $size) {
				$sizeName = $size->getName();
				$filePath = $this->getImagePath($file, $sizeName);

				if (file_exists($filePath)) {
					
					$result = unlink($filePath);

					if ( ! $result) {
						throw new Exception\RuntimeException("Could not delete '$filePath' from file storage");
					}
				}

				$this->createResizedImage($file, $size->getTargetWidth(), $size->getTargetHeight(), $size->getCropMode(), $size->getQuality(), true);
			}
		}
	}
551537
public function previewAdjustments() {
		$image_id = esc_html($_POST['image_id']);
		$size = esc_html($_POST['size']);

		if(!current_user_can('edit_post', $image_id)) {
			json_response([
				              'status' => 'error',
				              'message' => 'You are not strong enough, smart enough or fast enough.'
			              ]);
		}


		$params = (isset($_POST['settings'])) ? $_POST['settings'] : [];
		$result = $this->buildImgixImage($image_id, $size, $params);

		json_response(['status' => 'ok', 'src' => $result[0]]);
	}
1259853
private function createImagineInstance()
    {
        try {
            if (ImagerService::$imageDriver === 'gd') {
                return new \Imagine\Gd\Imagine();
            }

            if (ImagerService::$imageDriver === 'imagick') {
                return new \Imagine\Imagick\Imagine();
            }
        } catch (RuntimeException $e) {
            // just ignore for now
        }

        return null;
    }
488984
protected function applyActionsImage()
    {
        $actions = $this->image_style->getActions($this->data_imagestyle_id);

        if (empty($actions)) {
            throw new RuntimeException('No image style actions to apply');
        }

        $this->image_style->applyActions($actions, $this->data_source_file, $this->data_cached_file);
    }
1157785
public function generate()
    {
        if (!$this->iKnowWhatIAmDoing) {
            throw new \Exception('You don\'t know what you\'re doing!');
        }

        $this->cleanUp();

        $schema = $this->getSchema();

        echo "Interfaces generation...\r\n";
        $this->generateInterfaces();

        echo "Class generation...\r\n";
        $this->generateClasses($schema);

        if ($this->backwardCompatibility) {
            $this->php7ClassNames = false;
            $this->generateClasses($schema);
            $this->php7ClassNames = true;
        }
    }