public function save($pFilename)
{
if (empty($pFilename)) {
throw new \Exception("Filename is empty.");
}
$oPresentation = $this->getPhpPresentation();
// Create new ZIP file and open it for writing
$objZip = $this->getZipAdapter();
// Try opening the ZIP file
$objZip->open($pFilename);
// Add media
$slideCount = $oPresentation->getSlideCount();
for ($i = 0; $i < $slideCount; ++$i) {
for ($j = 0; $j < $oPresentation->getSlide($i)->getShapeCollection()->count(); ++$j) {
if ($oPresentation->getSlide($i)->getShapeCollection()->offsetGet($j) instanceof AbstractDrawing) {
$imgTemp = $oPresentation->getSlide($i)->getShapeCollection()->offsetGet($j);
$objZip->addFromString('media/' . $imgTemp->getFilename(), file_get_contents($imgTemp->getPath()));
}
}
}
// Add PhpPresentation.xml to the document, which represents a PHP serialized PhpPresentation object
$objZip->addFromString('PhpPresentation.xml', $this->writeSerialized($oPresentation, $pFilename));
// Close file
$objZip->close();
}