Display image, image can be cropped with croppa
@param string $content
@param array $options
@return string
975745
public function display($content, $options = [])
    {
        $imageData = $this->_defaultData($content);

        if (empty($imageData->file)) {
            return '';
        }

        if (empty($imageData->title)) {
            if (empty($options['title'])) {
                $fileName = substr(strrchr($imageData->file, '/'), 1);
                $imageData->title = str_replace('_', ' ', preg_replace('/\\.[^.\\s]{3,4}$/', '', $fileName));
            } else {
                $imageData->title = $options['title'];
            }
        }

        $imageData->extra_attrs = '';
        $ignoreAttributes = ['height', 'width', 'group', 'view', 'title', 'croppaOptions', 'version'];
        foreach ($options as $option => $val) {
            if (!in_array($option, $ignoreAttributes)) {
                $imageData->extra_attrs .= $option . '="' . $val . '" ';
            }
        }

        $imageData->group = !empty($options['group']) ? $options['group'] : '';
        $imageData->original = URL::to($imageData->file);

        $height = !empty($options['height']) ? $options['height'] : null;
        $width = !empty($options['width']) ? $options['width'] : null;
        if ($height || $width) {
            $croppaOptions = !empty($options['croppaOptions']) ? $options['croppaOptions'] : [];
            $imageData->file = str_replace(URL::to('/'), '', $imageData->file);
            $imageData->file = \Croppa::url($imageData->file, $width, $height, $croppaOptions);
        } else {
            $imageData->file = $imageData->original;
        }
        return $this->_renderDisplayView($options, $imageData);
    }
1047280
public function process($content, array $options = [])
    {
        $found = false;
        if (is_string($content)) {
            $tagNames = array_keys($this->tagNames);
            $tagNames[] = 'component';
            foreach ($tagNames as $tagName) {
                if (strpos($content, '<' . $tagName) !== false) {
                    $found = true;
                    break;
                }
            }
        }
        if ($content instanceof \IvoPetkov\HTMLServerComponent) {
            $found = true;
        }
        if ($found) {
            if (self::$newCompilerCache === null) {
                self::$newCompilerCache = new \IvoPetkov\BearFramework\Addons\HTMLServerComponents\Internal\Compiler();
            }
            $compiler = clone(self::$newCompilerCache);
            foreach ($this->aliases as $alias => $original) {
                $compiler->addAlias($alias, $original);
            }
            foreach ($this->tagNames as $tagName => $src) {
                $compiler->addTag($tagName, $src);
            }
            return $compiler->process($content, $options);
        }
        return $content;
    }
821592
public static function badgeLabel($content, $options = [])
    {
        static::addCssClass($options, 'label');
        $color = ArrayHelper::remove($options, 'color', static::LABEL_DEFAULT);
        static::addCssClass($options, $color);
        return static::tag(ArrayHelper::remove($options, 'tag', 'span'), $content, $options);
    }
580125
private function generateFile($content, $chunkPath, array $options)
    {
        $data = new ContentData($content, $options);

        $this->outputGenerator->reset();
        $this->outputGenerator->startDocument($data);

        $contents = array();
        foreach ($data->contents as $contentTypes) {
            foreach ($contentTypes as $contentType) {
                $contents[] = $contentType;
            }
        }

        $this->contentListElementGenerator->generateElement($this->outputGenerator, $contents);

        unset($contents);

        $filePath = $this->fileSystemHelper->getDir() . $chunkPath;
        $this->fileSystemHelper->save($filePath, $this->outputGenerator->endDocument($data));

        unset($data);

        $this->logger->info(sprintf('Generating file: %s', $filePath));
    }
447809
public function crop(array $options = []) {
		if (empty($options['height']) || empty($options['width'])) {
			throw new \InvalidArgumentException('You have to pass height and width in the options!');
		}

		$defaults = [
			'cropX' => 0,
			'cropY' => 0
		];

		$options = array_merge($defaults, $options);

		$this->_image->crop(
			new Point($options['cropX'], $options['cropY']),
			new Box($options['width'], $options['height'])
		);
		return $this;
	}
765469
public function keyword($title, $content, $options = [])
    {
        $data = array_merge([
            'title'   => $title, 
            'content' => $content
        ], $options);

        return $this->send('keyword', $data);
    }
526417
public static function badge($content, $options = [])
    {
        static::addCssClass($options, 'badge');
        $color = ArrayHelper::remove($options, 'color');
        if (!empty($color)) {
            static::addCssClass($options, $color);
        }
        return static::tag(ArrayHelper::remove($options, 'tag', 'span'), $content, $options);
    }
239983
public function transform($content, $options = [])
    {
        if (!$content || !is_string($content)) {
            return $content;
        }

        // prepend slashes if necessary
        if (strpos((string) $content, self::NAMESPACE_DELIMITER) !== 0) {
            $content = self::NAMESPACE_DELIMITER . $content;
        }

        if (empty($options[self::NAMESPACE_OPTION_INDEX])) {
            return $content;
        }

        if (strpos($content, $options[self::NAMESPACE_OPTION_INDEX]) === false) {
            if (strpos($options[self::NAMESPACE_OPTION_INDEX], self::NAMESPACE_DELIMITER) !== 0) {
                $content = self::NAMESPACE_DELIMITER . $options[self::NAMESPACE_OPTION_INDEX] . $content;
            } else {
                $content = $options[self::NAMESPACE_OPTION_INDEX] . $content;
            }
        }

        return $content;
    }
1343398
public function display($content, $options = [])
    {
        if (!empty($options['meta']) || !empty($options['pageBuilder'])) {
            $content = preg_replace_callback(
                '/{{\s*\$(?P<block>\w*)\s*}}/',
                function ($matches) {
                    return str_replace('"', "'", strip_tags(PageBuilder::block($matches['block'])));
                },
                $content
            );
            $content = str_replace('%page_name%', PageBuilder::pageName(), $content);
            $content = str_replace('%site_name%', config('coaster::site.name'), $content);
        }
        if (!empty($options['meta'])) {
            $content = trim(str_replace(PHP_EOL, ' ', $content));
            $content = preg_replace('/\s+/', ' ', $content);
            $content = htmlentities(strip_tags(html_entity_decode($content, ENT_QUOTES, 'UTF-8')));
            $content = StringHelper::cutString($content);
        }
        return parent::display($content, $options);
    }
352837
public function write($content, $options = 448) : void
    {
        $json = json_encode($content, $options) . ($options & JSON_PRETTY_PRINT ? "\n" : '');
        parent::write($json);
    }
1102143
public function filter($content, array $options = array())
    {
        $metadata = $this->property->getMetadata();

        $mediaElement = $metadata->offsetExists('media')
            ? $metadata->get('media')->getReferencedElement()
            : null;

        if ($mediaElement === null) {
            return null;
        }

        if ($mediaElement instanceof ImageReferencedElement) {
            return $this->handleImageElement($mediaElement);
        } elseif ($mediaElement instanceof MediaReferencedElement) {
            return $this->handleMediaElement($mediaElement);
        } else {
            return null;
        }
    }
831584
public static function purify($content, array $options = [])
    {
        $config = HTMLPurifier_Config::createDefault();

        foreach ($options as $key => $value) {
            $config->set($key, $value);
        }

        if (!file_exists($config->get('Cache.SerializerPath'))) {
            mkdir($config->get('Cache.SerializerPath'));
        }

        $purifier = new HTMLPurifier($config);

        return $purifier->purify($content);
    }
879287
public function keyword($title, $content, $options=array()){

        $data = array();
        
        $data['title'] = $title;
        $data['content'] = $content;

        $data = array_merge($data, $options);
        $data = mb_convert_encoding(json_encode($data), 'GBK', 'UTF8');

        return $this->request($this->keywordUrl, $data);
    }
3016
public function filter($content, array $options = array())
	{
		$itemTemplate = ! empty($options['itemTemplate']) ? (string) $options['itemTemplate'] : '';
		$wrapperTemplate = ! empty($options['wrapperTemplate']) ? (string) $options['wrapperTemplate'] : '';

		$output = '';

		$fileStorage = $this->container['cms.file_storage'];
		/* @var $fileStorage \Supra\Package\Cms\FileStorage\FileStorage */

		foreach ($this->blockProperty->getMetadata() as $metadata) {
			/* @var $metadata \Supra\Package\Cms\Entity\BlockPropertyMetadata */

			$element = $metadata->getReferencedElement();

			if (! $element instanceof ImageReferencedElement
					|| $element->getSizeName() === null) {

				continue;
			}

			$image = $fileStorage->findImage($element->getImageId());

			if ($image === null) {
				continue;
			}

			$previewSize = $image->getImageSize($element->getSizeName());

			if ($previewSize === null) {
				continue;
			}

			$previewUrl = $fileStorage->getWebPath($image, $previewSize);

			$crop = isset($options['fullSizeCrop']) ? (bool) $options['fullSizeCrop'] : true;

			$fullSizeWidth = ! empty($options['fullSizeMaxWidth']) ? (int) $options['fullSizeMaxWidth'] : null;
			$fullSizeHeight = ! empty($options['fullSizeMaxHeight']) ? (int) $options['fullSizeMaxWidth'] : null;

			try {

				list($width, $height) = $this->getFullSizeDimensions($image, $fullSizeWidth, $fullSizeHeight, $crop);
				$fullSizeName = $fileStorage->createResizedImage($image, $width, $height, $crop);

			} catch (FileStorageException $e) {
				$this->container->getLogger()->warn($e->getMessage());
				continue;
			}

			$fullSize = $image->getImageSize($fullSizeName);
			$fullSizeUrl = $fileStorage->getWebPath($image, $fullSize);

			$itemData = array(
				'image' 		=> '<img src="' . $previewUrl . '" alt="' . $element->getAlternateText() . '" />',
				'imageUrl' 		=> $previewUrl,
				'title' 		=> $element->getTitle(),
				'description' 	=> $element->getDescription(),

				'fullSizeUrl' 	=> $fullSizeUrl,
				'fullSizeWidth' => $fullSize->getWidth(),
				'fullSizeHeight' => $fullSize->getHeight(),
			);

			$output .= preg_replace_callback(
				'/{{\s*(image|title|description|fullSizeUrl|fullSizeWidth|fullSizeHeight)\s*}}/',
				function ($matches) use ($itemData) {
					return $itemData[$matches[1]];
				},
				$itemTemplate
			);
		}

		return preg_replace('/{{\s*items\s*}}/', $output, $wrapperTemplate);
	}
463169
public function crop($width = null, $height = null, $options = null)
    {
        $this->config = [
            'width'   => $width,
            'height'  => $height,
            'options' => $options,
        ];

        return $this;
    }
1216537
public function value($options = [], $content = '')
    {
        if (!is_array($options)) {
            $options = ['value' => $options];
        }

        $this->values[] = new Option($this->form->expression('option'), $options, $content);
        return $this;
    }
1036907
public function crop( array $options = [] ) : Image
	{
		$this->cropOption = empty( $options ) ? $this->cropOption : $options;
		// 裁剪
		$img = ImageManage::make( $this->originFileInfo['path'] );
		foreach( $this->cropOption as $suffix => $option ){
			list( $width, $height ) = $option;
			$img->resize( $width, $height, function( $constraint ){
				$constraint->aspectRatio();
			} );
			// 水印 todo 位置设置 目前是左上角
			if( $this->watermark === true ){
				$img->insert( 'Public/watermark.png' );
			}
			$target_file_name = "{$this->targetFolder}/{$this->fileName}_{$suffix}.{$this->ext}";

			// 生成略显图
			$img->save( $target_file_name );

			// 记录裁剪图片的信息
			$this->cropImages[$suffix] = $this->getImageInfoFormatData( $target_file_name );
		}
		return $this;
	}