PHP 7 Script to Encode the Image From URL to Base64 Code Full Project For Beginners

  • Post author:
  • Post category:PHP
  • Post comments:0 Comments


Welcome folks today in this blog post we will be encoding the image from url to base64 code in php 7. All the full source code of the application is shown below.




Get Started




In order to get started you need to make an index.php file and copy paste the following code







// Get the image and convert into string
$img = file_get_contents(

// Encode the image string data into base64
$data = base64_encode($img);

// Display the output
echo $data;

Leave a Reply