PHPExcel reads an image in EXCEL and saves it to a local device ,. PHPExcel is a very powerful class library for generating MSOfficeExcel documents. when you need to output complex format data, PHPE PHPExcel: how to read an image from an EXCEL file and save it to a local file,
HPExcel is a very powerful MS Office Excel file generation class library, when you need to output more complex format data, PHPExcel is a good choice.
After carefully studying the API documentation and viewing official documentation, I finally found the image in EXCEL. Currently, I can only read the image in excel 2003 format. Excel2007 does not seem to be supported yet. The main APIs are PHPExcel_Worksheet, PHPExcel_Worksheet_BaseDrawing, and PHPExcel_Worksheet_MemoryDrawing.
Put the following code directly:
The code is as follows:
Require_once './Classes/PHPExcel. php ';
$ ObjPHPExcel = new PHPExcel ();
$ ObjReader = PHPExcel_IOFactory: createReader ('excel5'); // load the 2003
$ ObjPHPExcel = $ objReader-> load ("goods_list.xls"); // load the file
Foreach ($ objPHPExcel-> getSheet (0)-> getDrawingCollection () as $ k => $ drawing ){
$ Codata = $ drawing-> getCoordinates (); // Obtain the unit data, such as the G2 unit.
$ Filename = $ drawing-> getIndexedFilename (); // file name
Ob_start ();
Call_user_func (
$ Drawing-> getRenderingFunction (),
$ Drawing-> getImageResource ()
);
$ ImageContents = ob_get_contents ();
File_put_contents ('Pic/'.w.codata.'_'.w.filename.'.jpg ', $ imageContents); // Save the file to your local device.
Ob_end_clean ();
}
Sheet, HPExcel is quite powerful MS Office Excel document generation class library, when you need to output more complex format data, PHPE...