0

How to hide an url with base64 like this?

<img src="show_image.php?url=aHR0cDovL2RvbWFpbi5jb20vaW1hZ2UuanBn">
Krupal Panchal
  • 1,553
  • 2
  • 13
  • 26

1 Answers1

0

In php you can encode in base64 with base64_encode(), and decode with base64_decode().

So, in your html page script you can do:

<?php
$imageUrl = 'the image url';
echo '<img src="show_image.php?url=' . base64_encode($imageUrl) . '">';

And of course, you'll need to decode it on your show_image script:

<?php
$imageUrl = base64_decode($_GET['url']);
$image = imagecreatefromstring(file_get_contents($imageUrl));
header('Content-Type: image/png');
imagepng($image);
rubenccdev
  • 161
  • 4