Created
August 3, 2012 01:02
-
-
Save outman/3242899 to your computer and use it in GitHub Desktop.
Exprot Online Image to Excel by PHPExcel
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
require_once __DIR__ . '/PHPExcel/Classes/PHPExcel.php'; | |
$objPHPExcel = new PHPExcel(); | |
// imagecreatefromXXX (XXX is jpeg png or gif) | |
$gdImage = imagecreatefromjpeg('http://678bt.com/PHPExcel/Tests/images/officelogo.jpg'); | |
$objDrawing = new PHPExcel_Worksheet_MemoryDrawing(); | |
$objDrawing->setName('Sample image'); | |
$objDrawing->setDescription('Sample image'); | |
$objDrawing->setImageResource($gdImage); | |
$objDrawing->setRenderingFunction(PHPExcel_Worksheet_MemoryDrawing::RENDERING_JPEG); | |
$objDrawing->setMimeType(PHPExcel_Worksheet_MemoryDrawing::MIMETYPE_DEFAULT); | |
$objDrawing->setHeight(36); | |
$objDrawing->setWorksheet($objPHPExcel->getActiveSheet()); | |
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007'); | |
$objWriter->save(str_replace('.php', '.xlsx', __FILE__)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment