title: Is file_get_contents in PHP the same as toDataUrl in Javascript?
body: <p>I want to use an API to compress images. It says the input can as well be a buffer (string with binary), for example:</p>
  
  <pre><code>$sourceData = file_get_contents("unoptimized.jpg");
  $resultData = \Tinify\fromBuffer($sourceData)-&gt;toBuffer();
  </code></pre>
  
  <p>In my understanding, they use <code>file_get_contents</code> to create that buffer from a file.</p>
  
  <p>In my case, I already got an canvas image using a React application. To make the API call, I create a data URI, using <code>.toDataURL()</code> looking something like this:</p>
  
  <pre><code>data:image/png;base64,iVBORw0KGgoAAAANSUh... // lots of letters
  </code></pre>
  
  <p>So can I just use this data URI instead of <code>file_get_contents</code>, because both commands actually do the same in different languages, or is there a difference? Like:</p>
  
  <pre><code>$sourceData = 'data:image/png;base64,iVBORw0KGgoAAAANSUh...'
  \Tinify\fromBuffer($sourceData)-&gt;toBuffer();
  </code></pre>
  
  <p>API Reference: <a href="https://tinypng.com/developers/reference/php" rel="nofollow noreferrer">https://tinypng.com/developers/reference/php</a></p>