Set openGraphImage

@param \Enhavo\Bundle\MediaBundle\Entity\File $openGraphImage
@return Content
506310
public function setOpenGraphImage(\Enhavo\Bundle\MediaBundle\Entity\File $openGraphImage = null)
    {
        $this->openGraphImage = $openGraphImage;

        return $this;
    }
501998
public function setOptiPng(\PHPImageOptim\Tools\Png\OptiPng $optiPng)
    {
        $this->optiPng = $optiPng;
        return $this;
    }
813466
public function setImageFromFile($file)
    {
        if (preg_match('/\.([^\.]+)$/', $file, $match) === 1) {
            $this->setMimeType('image/' . $match[1]);
        }
        return $this->setImageFromBlob(file_get_contents($file));
    }
505218
public static function buildImage( $config, $data )
	{
		$graph	= self::buildGraph( $config, $data );
		$graph->stroke();
	}
16830
public static function setCustomOpenGraphTag($key, $value)
    {
        $key   = (string)$key;
        $value = (string)$value;

        self::$store['flag']['custom:og:external'] = true;
        self::$store['custom:og'][$key] = $value;
    }
73624
public function bindGraph($graph) {
        if (is_string($graph)) {
            $graph= $this->xpdo->fromJSON($graph);
        }
        if (is_array ($graph)) {
            if ($this->graph !== $graph) {
                $this->graph= $graph;
                $this->select($this->xpdo->getSelectColumns($this->_class, $this->_alias, $this->_alias . '_'));
                foreach ($this->graph as $relationAlias => $subRelations) {
                    $this->bindGraphNode($this->_class, $this->_alias, $relationAlias, $subRelations);
                }
                if ($pk= $this->xpdo->getPK($this->_class)) {
                    if (is_array ($pk)) {
                        foreach ($pk as $key) {
                            $this->sortby($this->xpdo->escape($this->_alias) . '.' . $this->xpdo->escape($key), 'ASC');
                        }
                    } else {
                        $this->sortby($this->xpdo->escape($this->_alias) . '.' . $this->xpdo->escape($pk), 'ASC');
                    }
                }
            }
        }
        return $this;
    }
419771
public function onOpen(OpenResourceEvent $event)
    {
        $subRequest = $this->request->duplicate([], null, [
            '_controller' => 'ClarolineResultBundle:Result:result',
            'id' => $event->getResource()->getId(),
        ]);
        $event->setResponse($this->kernel->handle($subRequest, HttpKernelInterface::SUB_REQUEST));
        $event->stopPropagation();
    }
825686
public function defaultImage()
    {
        // Return an empty Image object if no default value
        if (empty($this->value)) {
            return new Image;
        }

        // All src images must live in the /img (relative) directory
        if (!Str::is('/img/*', $this->value)) {
            $msg = 'Element images must be stored in public/img: '.$this->value;
            throw new Exception($msg);
        }

        // Check if the image already exists in the uploads directory
        $src = $this->value;
        $src_abs = public_path($src);
        $path = str_replace('/img/', '/elements/', $src);
        if (!app('upchuck.disk')->has($path)) {

            // Copy it to the disk
            $stream = fopen($src_abs, 'r+');
            app('upchuck.disk')->writeStream($path, $stream);
            fclose($stream);
        }

        // Wrap the touching of the element and images table in a transaction
        // so that the element isn't updated if the images write fails
        DB::beginTransaction();

        // Update or create this Element instance
        $this->value = app('upchuck')->url($path);
        $this->save();

        // Create and return new Image instance. The Image::populateFileMeta()
        // requires an UploadedFile, so we need to do it manually here.
        $size = getimagesize($src_abs);
        $image = new Image([
            'file' => $this->value,
            'name' => $this->inputName(),
            'file_type' => pathinfo($src_abs, PATHINFO_EXTENSION),
            'file_size' => filesize($src_abs),
            'width'     => $size[0],
            'height'    => $size[1],
        ]);
        $this->images()->save($image);
        DB::commit();

        // Clear cached image relations
        unset($this->relations['images']);

        // Return the image
        return $image;
    }
691132
private function openImage()
	{
		try
		{
			$image_atts = getimagesize($this->source);
			if (empty($image_atts))
			{
				return false;
			}

			switch ($image_atts['mime'])
			{
				case 'image/jpeg':
					$this->image_type = IMAGETYPE_JPEG;
					$this->resource   = imagecreatefromjpeg($this->source);
				break;
				case 'image/gif':
					$this->image_type = IMAGETYPE_GIF;
					$this->resource   = imagecreatefromgif($this->source);
				break;
				case 'image/png':
				case 'image/x-png':
					$this->image_type = IMAGETYPE_PNG;
					$this->resource   = imagecreatefrompng($this->source);
				break;
				default:
					return false;
				break;
			}

			if ($this->image_type == IMAGETYPE_PNG)
			{
				imagesavealpha($this->resource, true);
				imagealphablending($this->resource, false);
			}

			if (isset($this->config['auto_rotate']) && $this->config['auto_rotate'] == true)
			{
				$this->autoRotate();
			}

			if (!empty($this->resource))
			{
				return true;
			}
			return false;
		}
		catch (Exception $error)
		{
			$this->setError($error->getMessage());
			return false;
		}
	}
62008
public function setUrl($url)
    {
        $this->meta()->setUrl($url);
        $this->openGraph()->setUrl($url);

        return $this;
    }
1163137
public function setOgImage($ogImage, $locale = null)
    {
        $this->translate($locale, false)->setOgImage($ogImage);
        $this->mergeNewTranslations();

        return $this;
    }
1204072
public function openGraph($property, $content, $replace = false, $conditional = '')
    {
        return $this->headMeta(['property' => $property, 'content' => $content], $replace, $conditional);
    }
1058734
function generateOpenGraphTags( $nodeID )
    {
        $this->ogIni = eZINI::instance( 'ngopengraph.ini' );
        $this->facebookCompatible = $this->ogIni->variable( 'General', 'FacebookCompatible' );
        $this->debug = $this->ogIni->variable( 'General', 'Debug' ) == 'enabled';

        $availableClasses = $this->ogIni->variable( 'General', 'Classes' );

        if ( $nodeID instanceof eZContentObjectTreeNode )
        {
            $contentNode = $nodeID;
        }
        else
        {
            $contentNode = eZContentObjectTreeNode::fetch( $nodeID );
            if ( !$contentNode instanceof eZContentObjectTreeNode )
            {
                return array();
            }
        }

        $contentObject = $contentNode->object();

        if ( !$contentObject instanceof eZContentObject || !in_array( $contentObject->contentClassIdentifier(), $availableClasses ) )
        {
            return array();
        }

        $returnArray = $this->processGenericData( $contentNode );

        $returnArray = $this->processObject( $contentObject, $returnArray );

        if ( $this->checkRequirements( $returnArray ) )
        {
            return $returnArray;
        }
        else
        {
            if ( $this->debug )
            {
                eZDebug::writeDebug( 'No', 'Facebook Compatible?' );
            }

            return array();
        }
    }
688099
private static function _createGif( $imageFile ){
        $gift = new GifHelper();
        $bytes = $gift->open($imageFile);
        $animated = $gift->isAnimated($bytes);
        $blocks = '';
        if($animated){
            $blocks = $gift->decode($bytes);
        }
        $gd = @imagecreatefromgif( $imageFile );

        if(!$gd){
            throw new \Exception( sprintf('Could not open "%s". Not a valid %s file.', $imageFile, ImageType::GIF) );
        }

        return new self(
            $gd,
            $imageFile,
            imagesx( $gd ),
            imagesy( $gd ),
            ImageType::GIF,
            $blocks,
            $animated
        );
    }
398001
static function getInstance( eZContentObjectAttribute $objectAttribute )
    {
        $datatypeString = $objectAttribute->attribute( 'data_type_string' );
        $dataTypeHandlers = self::$ogIni->variable( 'OpenGraph', 'DataTypeHandlers' );

        if ( array_key_exists( $datatypeString, $dataTypeHandlers ) )
        {
            if ( class_exists( $dataTypeHandlers[$datatypeString] ) )
            {
                return new $dataTypeHandlers[$datatypeString]( $objectAttribute );
            }
        }

        return new ngOpenGraphBase( $objectAttribute );
    }
1038137
public function renderOpenGraphTags(Content $content)
    {
        try {
            return $this->tagRenderer->render(
                $this->getOpenGraphTags($content)
            );
        } catch (Exception $e) {
            if ($this->throwExceptions || !$this->logger instanceof LoggerInterface) {
                throw $e;
            }

            $this->logger->error($e->getMessage());
        }

        return '';
    }
181638
public function setImageOG($imageObj)
    {
        if($imageObj) {
            Meta::set("og:image", asset($imageObj->url), "property");
            Meta::set("og:image:type", $imageObj->type."/".str_replace("jpg", "jpeg", $imageObj->extension), "property");
            if($imageObj->description) {
                Meta::set("og:image:alt", $imageObj->description, "property");
            }

            if($imageObj->dimensions) {
                $image = explode("x", $imageObj->dimensions);
                Meta::set("og:image:width", $image[0], "property");
                Meta::set("og:image:height", $image[1], "property");
            }
        }
        return $this;
    }