title: Converting image datatype from Sql Server to php
body: <p>I'm trying to show an image saved from SQL Server from the database to the php page I am creating. What I've done so far is I get the necessary data from the database, which is the image , and the image type(if its a jpg).</p>
  
  <p>This is what I did:</p>
  
  <pre><code>            $idata = base64_decode($imageResult);
              imagejpeg($idata);
  </code></pre>
  
  <p>But it is showing an error of the following:</p>
  
  <pre><code> imagejpeg() expects parameter 1 to be resource, string given [APP\Controller\MainController.php, line 226]
  </code></pre>
  
  <p>How do I make the image show inside my php? Do I need to decode the data that I'm getting from the database before I could convert it?</p>
  
  <p>I want to give an example but the data that I currently have is very sensitive, which is why I don't know how I could give an example.</p>