title: Convert image to base 64 string with Laravel
body: <p>I want to convert an image to base 64 with Laravel. I get the image from a form .
  I tried this in my controller:</p>
  
  <pre><code>public function newEvent(Request $request){
      $parametre =$request-&gt;all();
  
      if ($request-&gt;hasFile('image')) {
          if($request-&gt;file('image')-&gt;isValid()) {
              try {
                  $file = $request-&gt;file('image');
                  $image = base64_encode($file);
                  echo $image;
  
  
              } catch (FileNotFoundException $e) {
                  echo "catch";
  
              }
          }
      }
  </code></pre>
  
  <p>I get this only:</p>
  
  <blockquote>
    <p>L3RtcC9waHBya0NqQlQ=</p>
  </blockquote>