小编rSa*_*ara的帖子

使用PHP从Excel文件(xlsx)中提取图像

如何使用PHPExcel从excel文件中读取图像并将图像保存在服务器中并显示它们?该文件的扩展名为.xlsx.

我的代码:

$objPHPExcel = PHPExcel_IOFactory::load($path);

foreach ($objPHPExcel->getActiveSheet()->getDrawingCollection() as $drawing) {
    if ($drawing instanceof PHPExcel_Worksheet_MemoryDrawing) {
        ob_start();
        call_user_func(
            $drawing->getRenderingFunction(),
            $drawing->getImageResource()
        );
        $imageContents = ob_get_contents();

        ob_end_clean();
    }

}
Run Code Online (Sandbox Code Playgroud)

谢谢!!

php phpexcel

3
推荐指数
1
解决办法
5542
查看次数

标签 统计

php ×1

phpexcel ×1