image.php 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. <?php
  2. $url = "";
  3. $loc = "US";
  4. if( isset( $_GET['loc'] ) ) {
  5. $loc = strtoupper($_GET["loc"]);
  6. }
  7. //get the image url
  8. if (isset( $_GET['i'] ) ) {
  9. $url = $_GET[ 'i' ];
  10. } else {
  11. exit();
  12. }
  13. //we can only do jpg and png here
  14. if (strpos($url, ".jpg") && strpos($url, ".jpeg") && strpos($url, ".png") != true ) {
  15. echo strpos($url, ".jpg");
  16. echo "Unsupported file type :(";
  17. exit();
  18. }
  19. //image needs to start with http
  20. if (substr( $url, 0, 4 ) != "http") {
  21. echo("Image failed :(");
  22. exit();
  23. }
  24. ?>
  25. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 2.0//EN">
  26. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  27. <html>
  28. <head>
  29. <title>68k.news Image Viewer</title>
  30. </head>
  31. <body">
  32. <small><a href="<?php echo $_SERVER['HTTP_REFERER'] . '?loc=' . strtoupper($loc) ?>">< Back to article</a> | <a href="/index.php"><font color="#9400d3">68k.news</font> front page</a></small>
  33. <p><small><b>Viewing image:</b> <?php echo $url ?></small></p>
  34. <img src="/image_compressed.php?i=<?php echo $url; ?>">
  35. <br><br>
  36. <small><a href="<?php echo $_SERVER['HTTP_REFERER'] . '?loc=' . strtoupper($loc) ?>">< Back to article</a> | <a href="/index.php"><font color="#9400d3">68k.news</font> front page</a></small>
  37. </body>
  38. </html>