title: Image from database into PDF using FPDF
body: <p>I have an image that is sent from an iPad app to an <code>SQL</code> database. I can retrieve this image and display in a web page using the following <code>php</code>:</p>
  
  <pre><code>$img = base64_encode($row['photoData']);
  echo "&lt;img src=\"data:image/jpg;charset=utf8;base64, $img\"/&gt;";
  </code></pre>
  
  <p>This displays fine. What I want to do now is put this image into a <code>PDF</code> document using <code>FPDF</code> however I am struggling to do this. </p>
  
  <p>This: </p>
  
  <pre><code>$img = base64_encode($row['photoData']);
  $pdf-&gt;Image($img);
  </code></pre>
  
  <p>give this error:</p>
  
  <blockquote>
    <p>FPDF error: Image file has no extension and no type was specified:</p>
  </blockquote>
  
  <p>So I tried this (although I realise I will then have to look at how to get the size of the image sorted):</p>
  
  <pre><code>$pdf-&gt;Image($img, 20, 20, 20, 20 'JPG');
  </code></pre>
  
  <p>which give me:</p>
  
  <blockquote>
    <p>FPDF error: Missing or incorrect image file:</p>
  </blockquote>
  
  <p>What is the correct way to do this?</p>
  
  <p>Or would it be easier to temporarily save the image to the server and then place the saved image into the <code>PDF</code>doc? </p>