title: How to convert image path to base64 encode data using PHP
body: <p>I need to convert the image URL to <code>base64_encode</code> data using PHP. I am explaining my code below.</p>
  
  <pre><code>&lt;?php
  $path='https://www.jquery-az.com/html/images/banana.jpg';
  $type = pathinfo($path, PATHINFO_EXTENSION);
  $data = file_get_contents($path);
  $base64=base64_encode($data);
  print_r($base64);exit;
  ?&gt;
  </code></pre>
  
  <p>Here I am getting the blank output. Please help me to resolve this issue.</p>