title: How to set the stream content in PHPExcel?
body: <p>I'm using PHP and PHPExcel to get the image filename from a database and perform the stream reader operation. I set my image by using the <code>setImageResource</code> function but it isn't working as expected. Here's my code:</p>
  
  <pre><code>&lt;?php
      require_once dirname(__FILE__) . '/../Classes/PHPExcel.php';
      require_once '../classes/PHPExcel/IOFactory.php';
      error_reporting(E_ALL);
      ini_set('display_errors', TRUE);
      ini_set('display_startup_errors', TRUE);
      date_default_timezone_set('Asia/Calcutta');
  
      if (PHP_SAPI == 'cli')
          die('This example should only be run from a Web Browser');
  
      $rendererName = PHPExcel_Settings::PDF_RENDERER_DOMPDF;
      $rendererLibrary = 'dompdf.php';
      $rendererLibraryPath = dirname(__FILE__) . '/../libs/classes/dompdf/';
  
      // Create new PHPExcel object
      $objPHPExcel = new PHPExcel();
  
      $objPHPExcel-&gt;setActiveSheetIndex(0);
      $objPHPExcel-&gt;getActiveSheet()-&gt;SetCellValue('A1', 'Tes');
      $objPHPExcel-&gt;getActiveSheet()-&gt;SetCellValue('B1', 'Image...');
      $objPHPExcel-&gt;getActiveSheet()-&gt;setTitle('Simple');
      $img = imagecreatefrompng('C:/Users/Downloads/logo.png');
      $objDrawing = new PHPExcel_Worksheet_MemoryDrawing();
      $objDrawing-&gt;setName('Test image');
      $objDrawing-&gt;setDescription('Test image');
      $objDrawing-&gt;setImageResource($img);
      $objDrawing-&gt;setRenderingFunction(PHPExcel_Worksheet_MemoryDrawing::RENDERING_PNG);
      $objDrawing-&gt;setMimeType(PHPExcel_Worksheet_MemoryDrawing::MIMETYPE_DEFAULT);
      $objDrawing-&gt;setHeight(150);
      $objDrawing-&gt;setCoordinates('A4');
      $objDrawing-&gt;setWorksheet($objPHPExcel-&gt;getActiveSheet());
  
  
  
      if (!PHPExcel_Settings::setPdfRenderer($rendererName,$rendererLibraryPath)) {
          die(
          'NOTICE: Please set the $rendererName and $rendererLibraryPath values' .
          '&lt;br /&gt;' .
          'at the top of this script as appropriate for your directory structure'
          );
      } 
  
      $objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'PDF');
      $objWriter-&gt;save('test.pdf');
      exit;
  </code></pre>