Image not found

Topics: Developer Forum
Dec 17, 2010 at 10:16 AM

Hi. I have a script that generate excel download. I added an image on every excel file. My problem is that there were times that the image was not found on the file. I check the file path and it was fine, the file exists. Does someone has any idea where did the image go? I am using the latest release of PHPExcel and I was creating a .xlsx file, Excel2007 is my writer. Any help would be much appreciated. Thanks!

Dec 20, 2010 at 5:14 PM

I had a problem in the past where I generated a graph, and wanted to attach it to the data that was written to Excel using PHPExcel.  Maybe try adding sleep(1); just before you create the binary writer and save the file - this seemed to help me:

$excelBinaryWriter = PHPExcel_IOFactory::createWriter($objExport, 'Excel5');


Dec 22, 2010 at 12:05 AM

If you're creating the image files dynamically within the same script as the PHPExcel, then it's possible that the operating system hasn't yet flushed the image file changes to disk. The sleep would give the OS the opportunity to actually write those changes.

Dec 22, 2010 at 7:07 AM

Actually, this is ok when tested in Windows. I just wonder why the image doesn't appear when I am using Linux. Anyway, thank you so much for you time. Your answers were really appreciated. :D