I want to read/retrieve an Image from excel file to PHP using PHPExcel.
This code is used to retrieve a value from a particular cell.
$objPHPExcel-
Googling phpexcel read image yielded this page as the second result. It tells you how to do this.
To quote the relevant info directly:
$objPHPExcel->getActiveSheet()->getDrawingCollection()
will return an ArrayObject of all the image objects in the active worksheet.These objects will be either
PHPExcel_Worksheet_Drawing
orPHPExcel_Worksheet_MemoryDrawing
objects: you can identify which using is_a(). You can then use the methods appropriate to that class (as described in the API) either to read the image data from file (forPHPExcel_Worksheet_Drawing
objects) or directly from thePHPExcel_Worksheet_MemoryDrawing
object itself. ThegetName()
andgetDescription()
methods can be used to retrieve the relevant values from the image object.Note that it's also possible to have image objects associated with print headers:
$objPHPExcel->getActiveSheet()->getHeaderFooter()->getImages()
can be used to retrieve images from the header/footer. This is an array ofPHPExcel_Worksheet_HeaderFooterDrawing
objects. All thePHPExcel_Worksheet_Drawing
methods can be used to extract the image file from these objects.