-
Notifications
You must be signed in to change notification settings - Fork 526
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Intermittent Error "PowerPoint found a problem with content in the file"... #132
Comments
Which version do you use ? |
I think it is version 0.2.0 master. I only have the source code in my project, so I'm not 100% sure. |
PHPPowerPoint is actually in version 0.4. And this issue has been fixed in 0.3. |
@RightHandedMonkey Could you test with the latest version of the develop branch (with #89 & PR #167) ? |
@RightHandedMonkey PHPPowerPoint 0.6.0 has been released. I would like to solve your issue for 0.7.0. Could you test with the latest version of develop branch ? |
Answer from @RightHandedMonkey : Thanks for sticking with this and I will test it as soon as I can. The program is great and I use it a lot - so I really need to solve this issue. In trying to track down a solution to the intermittent issue I am having, I've collected an xdebug callgrind profiler dump of both having the issue and when not having the issue when generating the same powerpoint. If you would like a copy of that I can send you a link. I also added a piece of code to cache files (images) in memory. Since I am inserting the same image on every page I thought the multiple disk accesses could be causing the issue. It reduced my problem somewhat, but did not entirely go away. You might find this code useful as it greatly helps performance when using a lot of image files. Writer/PowerPoint2007.php
Writer/PptxImageLoader.php<?php
namespace PhpOffice\PhpPresentation\Writer;
/**
* Added by SEB to cache files that are loaded from disk multiple times.
* Greatly reduces disk access to create the pptx
*
* Usage:
* $data = PptxImageLoader::loadFileData($filename);
*
*/
class PptxImageLoader {
static $images = array();
public static $use_cache = true;
/**
* Retrieves and caches file data so that multiple requests for the same file are not necessary
* @param type $str
*/
public static function loadFileData($filepath) {
if (self::$use_cache && array_key_exists($filepath, self::$images)) {
return self::$images[$filepath];
} else {
//load and return string
self::$images[$filepath] = file_get_contents($filepath);
return self::$images[$filepath];
}
}
} |
@RightHandedMonkey May be you can test with develop branch ? |
i am having the same issue! the pptx that i am creating contains up to 2000 slides (on each slide there's an image) 50 to 100 images are missing |
@RightHandedMonkey PhpPresentation 0.8.0 has been released. I would like to solve your issue for 0.9.0. Could you answer to my question ? |
@RightHandedMonkey PhpPresentation 0.9.0 has been released. I would like to solve your issue for 0.10.0. Could you answer to my question ? |
Intermittently, on creation of a .pptx using the PHPPowerPoint library, I will get an error '"PowerPoint found a problem with content in the file' with the filename and a note:
PowerPoint can attempt to repair the file. If you trust the source of this file, click Repair.
When I open the pptx contents in these files that request repair, I've found that the ppt/media folder is missing one of the image files. The slides are getting the same image file, so I'm not sure what is going on there. I'm starting to think it has something to do with the ZipArchive ( $objZip->addFromString(...) ) call that is silently failing, but I'm not sure. There are no errors in the PHP error log and the problem is infrequent. I can simply rerun the creation another time and it works fine.
Please contact me if you want to see the resulting corrupted pptx file or for other information.
The text was updated successfully, but these errors were encountered: