mirror of
https://github.com/Karaka-Management/Resources.git
synced 2026-02-04 23:38:39 +00:00
39 lines
1.2 KiB
PHP
Executable File
39 lines
1.2 KiB
PHP
Executable File
<?php
|
|
|
|
namespace PhpOffice\PhpPresentation\Writer\ODPresentation;
|
|
|
|
use PhpOffice\Common\Adapter\Zip\ZipInterface;
|
|
use PhpOffice\PhpPresentation\Shape\Drawing;
|
|
use PhpOffice\PhpPresentation\Slide\Background\Image;
|
|
|
|
class Pictures extends AbstractDecoratorWriter
|
|
{
|
|
/**
|
|
* @return ZipInterface
|
|
* @throws \Exception
|
|
*/
|
|
|
|
public function render()
|
|
{
|
|
$arrMedia = array();
|
|
for ($i = 0; $i < $this->getDrawingHashTable()->count(); ++$i) {
|
|
$shape = $this->getDrawingHashTable()->getByIndex($i);
|
|
if (!($shape instanceof Drawing\AbstractDrawingAdapter)) {
|
|
continue;
|
|
}
|
|
$arrMedia[] = $shape->getIndexedFilename();
|
|
$this->getZip()->addFromString('Pictures/' . $shape->getIndexedFilename(), $shape->getContents());
|
|
}
|
|
|
|
foreach ($this->getPresentation()->getAllSlides() as $keySlide => $oSlide) {
|
|
// Add background image slide
|
|
$oBkgImage = $oSlide->getBackground();
|
|
if ($oBkgImage instanceof Image) {
|
|
$this->getZip()->addFromString('Pictures/'.$oBkgImage->getIndexedFilename($keySlide), file_get_contents($oBkgImage->getPath()));
|
|
}
|
|
}
|
|
|
|
return $this->getZip();
|
|
}
|
|
}
|