title: How to export image with MySQL data by PHPExcel
body: <p>In my MySQL table (label_entry) there are three columns namely:</p>
  <ol>
  <li>RBO</li>
  <li>Brand</li>
  <li>location (image link storing) for identifying a product item.</li>
  </ol>
  <p>My image folder location is &quot;../label_image/&quot;. I want to export MySQL data with image to Excel. I can export the MySQL data to excel but image is not exporting.</p>
  <p>If I define one image with full path information then the image is exporting, but I want to export all the image based on item and it should display per rows wise corresponding its item.</p>
  <p>I am new to PHPExcel and  don't know where I need to make correction. Any advice will help me to understand here.</p>
  <pre><code> $objPHPExcel = new PHPExcel();&lt;br/&gt;
   $query = &quot;SELECT * FROM label_entry&quot;;&lt;br/&gt;
   $result = mysql_query($query) or die(mysql_error());&lt;br/&gt;
   $objPHPExcel = new PHPExcel();&lt;br/&gt;
   $rowCount = 2;&lt;br/&gt;
  $objPHPExcel-&gt;getActiveSheet()-&gt;getStyle('A1:C1')-&gt;getFont()-&gt;setBold(true);&lt;br/&gt;
  $objPHPExcel-&gt;getActiveSheet()-&gt;getStyle('A1:C1')-&gt;getFont()-&gt;setSize(16);&lt;br/&gt;
  $objPHPExcel-&gt;getActiveSheet()-&gt;getStyle('A1:C1')-&gt;getFont()-&gt;setItalic(true);&lt;br/&gt;
  $objPHPExcel-&gt;getActiveSheet()-&gt;getColumnDimension('A')-&gt;setWidth(30);&lt;br/&gt;
  $objPHPExcel-&gt;getActiveSheet()-&gt;getColumnDimension('B')-&gt;setWidth(30);&lt;br/&gt;
  $objPHPExcel-&gt;getActiveSheet()-&gt;getColumnDimension('C')-&gt;setWidth(30);&lt;br/&gt;
  $objPHPExcel-&gt;getActiveSheet()-&gt;setTitle('Trim Database');&lt;br/&gt;
  $objPHPExcel-&gt;getActiveSheet()-&gt;setCellValue('A1','RBO');&lt;br/&gt;
  $objPHPExcel-&gt;getActiveSheet()-&gt;setCellValue('B1','BRAND');&lt;br/&gt;
  $objPHPExcel-&gt;getActiveSheet()-&gt;setCellValue('C1','IMAGE');&lt;br/&gt;
   while($row = mysql_fetch_array($result)){&lt;br/&gt;
  $objPHPExcel-&gt;getActiveSheet()-&gt;SetCellValue('A'.$rowCount, $row['RBO']);&lt;br/&gt;
  $objPHPExcel-&gt;getActiveSheet()-&gt;SetCellValue('B'.$rowCount, $row['Brand']);&lt;br/&gt;
  $objDrawing = new PHPExcel_Worksheet_Drawing();&lt;br/&gt;
  $objDrawing-&gt;setName('test_img');&lt;br/&gt;
  $objDrawing-&gt;setDescription('test_img');&lt;br/&gt;
  $objDrawing-&gt;setPath('../label_image/2PK.jpg');&lt;br/&gt;
  $objDrawing-&gt;setCoordinates('C1'); &lt;br/&gt;                     
  $objDrawing-&gt;setOffsetX(5); &lt;br/&gt;
  $objDrawing-&gt;setOffsetY(5); &lt;br/&gt;               
  $objDrawing-&gt;setWidth(105); &lt;br/&gt;
  $objDrawing-&gt;setHeight(45); &lt;br/&gt;
  $objDrawing-&gt;setWorksheet($objPHPExcel-&gt;getActiveSheet());&lt;br/&gt;
    $rowCount++;&lt;br/&gt;
  }
   header('Content-Type: application/vnd.openxmlformats-   officedocument.spreadsheetml.sheet');&lt;br/&gt;
   header('Content-Disposition: attachment;filename=&quot;survey.xlsx&quot;');&lt;br/&gt;
   header('Cache-Control: max-age=0');&lt;br/&gt;
   $objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');&lt;br/&gt;
   $objWriter-&gt;save('php://output');&lt;br/&gt;```
  </code></pre>