-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Opening an Excel file which reuses an image multiplies the image on save #543
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
Comments
I have just reproduced the problem. A workaround idea would be greatly appreciated 👍 |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. |
I'd really appreciate to keep this one open since it's still a bug. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. |
This is still an issue. Excel shows three times the same image and when checking the content (using unrar) there only one .png. When creating larger Excel reports based on a template containing multiple copies of a larger image, the PhpSpreadsheet generated file will grow very large. Please let me know when more information is needed. |
This is:
What is the expected behavior?
When one imagefile is reused in the Excel document for e.g. 3 times, it is only placed once in the xlsx file (can be checked by opening it with WinRAR).
After opening the file with PhpSpreadsheet and saving it the image file must still be reused in the xlsx file and placed only once.
This prevents large Excel sheets containing multiple copies, of e.g. a company logo, for growing to a huge file.
What is the current behavior?
After opening the xlsx file with PhpSpreadsheet and saving it, even without any additional processing, there are multiple image files in the xlsx file. When the document had 3 references, PhpSpreadsheet will put 3 image files in the xlsx.
What are the steps to reproduce?
Start a new document with Excel 2016, insert a small PNG image, copy and paste the image a few times. Save the document.
Rename it to .rar and open it with WinRAR, browse to xl/media to see only one png file.
Rename back to .xlsx and upload to webserver.
Please provide a Minimal, Complete, and Verifiable example of code that exhibits the issue without relying on an external Excel file or a web server:
You'll notice that the new file has increased roughly 2x the image size.
A check with WinRAR shows 3 copies of the file.
Which versions of PhpSpreadsheet and PHP are affected?
Just downloaded the lastest version here.
PHP version 7.0.23
The text was updated successfully, but these errors were encountered: