title: php image base64 encoding not working
body: <p>I hit an issue at my job where the base64 encoding did not work when I was using a full url. However I managed to make it work with relative path.</p>
  
  <p>Here's the code only working with relative path :</p>
  
  <pre><code>$type = pathinfo($this-&gt;logo_path);
  $data = file_get_contents($this-&gt;logo_path);
  echo "data:image/" . $type . ";base64," . base64_encode($data);
  </code></pre>
  
  <p>when <strong>$this->logo_path</strong> === "<a href="http://domain-name/assets/img/logo.png" rel="nofollow noreferrer">http://domain-name/assets/img/logo.png</a>", <strong>$data</strong> === NULL</p>
  
  <p>Is there anyone here with an explanation? I need to convert the image to put a page in a pdf file. I was able to work around my problem with a boolean variable determining whether I need a base64 convertion or not, but I would like to understand why.</p>