如何在phpexcel中显示数据库中的长blob图像?

时间:2015-06-01 10:04:09

标签: phpexcel

我有一个表存储长blob类型的图像数据,如何检索phpexcel中的图像显示?我的代码示例:

$order = "SELECT * FROM tblorder";

$tblorder = $conn->query($order);
$row_order = $tblorder->fetch(PDO::FETCH_ASSOC);
$image =$row_order["image"];
$data = base64_encode($image);

$objDrawing = new PHPExcel_Worksheet_MemoryDrawing();
$objDrawing->setName('image');
$objDrawing->setDescription('image');
$objDrawing->getIndexedFilename($data);
$objDrawing->setRenderingFunction(PHPExcel_Worksheet_MemoryDrawing::RENDERING_JPEG);
$objDrawing->setMimeType(PHPExcel_Worksheet_MemoryDrawing::MIMETYPE_DEFAULT);
$objDrawing->setCoordinates('A85');
$objDrawing->setWorksheet($sheet->getActiveSheet());

1 个答案:

答案 0 :(得分:0)

cls
import-module sqlps –DisableNameChecking -Verbose:$false | Out-Null
$sql = "USE [MASTER]
GO
CREATE LOGIN [ABC.PROD\My Group Name] FROM WINDOWS WITH DEFAULT_DATABASE=[master], DEFAULT_LANGUAGE=[us_english]
GO"
Invoke-Sqlcmd -Query $sql