Phpexcel read the pictures in Excel and save them to a local method,
Hpexcel is a fairly powerful MS Office Excel document Generation Library, and Phpexcel is a good choice when it comes to outputting more complex format data.
After careful study of API documentation and viewing official documents, finally found to read excel in the picture, currently I can only read Excel 2003 format. Excel2007 doesn't seem to support it. The main API used is phpexcel_worksheet,phpexcel_worksheet_basedrawing,phpexcel_worksheet_memorydrawing.
Say less nonsense, directly on the code:
Copy the Code code as follows:
Require_once './classes/phpexcel.php ';
$objPHPExcel = new Phpexcel ();
$objReader = Phpexcel_iofactory::createreader (' Excel5 '); Load 2003 of
$objPHPExcel = $objReader->load ("Goods_list.xls"); Loading files
foreach ($objPHPExcel->getsheet (0)->getdrawingcollection () as $k = = $drawing) {
$codata = $drawing->getcoordinates (); Get unit data like G2 unit
$filename = $drawing->getindexedfilename (); Filename
Ob_start ();
Call_user_func (
$drawing->getrenderingfunction (),
$drawing->getimageresource ()
);
$imageContents = Ob_get_contents ();
File_put_contents (' pic/'. $codata. ' _ '. $filename. ' JPG ', $imageContents); Save the file to a local
Ob_end_clean ();
}
http://www.bkjia.com/PHPjc/958722.html www.bkjia.com true http://www.bkjia.com/PHPjc/958722.html techarticle Phpexcel Read the pictures in Excel and save to the local method, Hpexcel is quite powerful in MS Office Excel document Generation Class library, when the need to output more complex format data, PHPE ...