<?php $url = $_GET['url']; $b64image = base64_encode(file_get_contents($url)); $type = pathinfo($url, PATHINFO_EXTENSION); echo "data:image/".$type.";base64,".$b64image;