Image not found

Topics: Developer Forum
Dec 17, 2010 at 9: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 4: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:

sleep(1);
$excelBinaryWriter = PHPExcel_IOFactory::createWriter($objExport, 'Excel5');
$excelBinaryWriter->save($export_file_path);

 

Coordinator
Dec 21, 2010 at 11:05 PM

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 6: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