PhpOffice\PhpPresentation\Reader\ODPresentation::loadShapeDrawing PHP Method

loadShapeDrawing() protected method

Read Shape Drawing
protected loadShapeDrawing ( DOMElement $oNodeFrame )
$oNodeFrame DOMElement
    protected function loadShapeDrawing(\DOMElement $oNodeFrame)
    {
        // Core
        $oShape = new Gd();
        $oShape->getShadow()->setVisible(false);
        $oNodeImage = $this->oXMLReader->getElement('draw:image', $oNodeFrame);
        if ($oNodeImage) {
            if ($oNodeImage->hasAttribute('xlink:href')) {
                $sFilename = $oNodeImage->getAttribute('xlink:href');
                // svm = StarView Metafile
                if (pathinfo($sFilename, PATHINFO_EXTENSION) == 'svm') {
                    return;
                }
                $imageFile = $this->oZip->getFromName($sFilename);
                if (!empty($imageFile)) {
                    $oShape->setImageResource(imagecreatefromstring($imageFile));
                }
            }
        }
        $oShape->setName($oNodeFrame->hasAttribute('draw:name') ? $oNodeFrame->getAttribute('draw:name') : '');
        $oShape->setDescription($oNodeFrame->hasAttribute('draw:name') ? $oNodeFrame->getAttribute('draw:name') : '');
        $oShape->setResizeProportional(false);
        $oShape->setWidth($oNodeFrame->hasAttribute('svg:width') ? (int) round(CommonDrawing::centimetersToPixels(substr($oNodeFrame->getAttribute('svg:width'), 0, -2))) : '');
        $oShape->setHeight($oNodeFrame->hasAttribute('svg:height') ? (int) round(CommonDrawing::centimetersToPixels(substr($oNodeFrame->getAttribute('svg:height'), 0, -2))) : '');
        $oShape->setResizeProportional(true);
        $oShape->setOffsetX($oNodeFrame->hasAttribute('svg:x') ? (int) round(CommonDrawing::centimetersToPixels(substr($oNodeFrame->getAttribute('svg:x'), 0, -2))) : '');
        $oShape->setOffsetY($oNodeFrame->hasAttribute('svg:y') ? (int) round(CommonDrawing::centimetersToPixels(substr($oNodeFrame->getAttribute('svg:y'), 0, -2))) : '');
        if ($oNodeFrame->hasAttribute('draw:style-name')) {
            $keyStyle = $oNodeFrame->getAttribute('draw:style-name');
            if (isset($this->arrayStyles[$keyStyle])) {
                $oShape->setShadow($this->arrayStyles[$keyStyle]['shadow']);
            }
        }
        $this->oPhpPresentation->getActiveSlide()->addShape($oShape);
    }