image_proxy.php 489 B

1234567891011121314151617181920
  1. <?php
  2. $config = require_once "config.php";
  3. require_once "misc/tools.php";
  4. $url = $_REQUEST["url"];
  5. $requested_root_domain = get_root_domain($url);
  6. $allowed_domains = array("i.ytimg.com", "s2.qwant.com", "s1.qwant.com", "upload.wikimedia.org");
  7. if (in_array($requested_root_domain, $allowed_domains))
  8. {
  9. $image = $url;
  10. $image_src = request($image, $config->curl_settings);
  11. header("Content-Type: image/png");
  12. echo $image_src;
  13. }
  14. ?>