Skip to content

Instantly share code, notes, and snippets.

@chyyran
Last active December 16, 2015 17:28
Show Gist options
  • Save chyyran/5470208 to your computer and use it in GitHub Desktop.
Save chyyran/5470208 to your computer and use it in GitHub Desktop.
Custom Gyazo Viewer (replace `uploads` with the folder your images are in)
Options +FollowSymlinks -MultiViews
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_REFERER} !/uploads/.*\.png
RewriteRule ^uploads/([^.]+)\.png /display.php?img=$1 [L,NC,QSA]
<?php
if (!isset($_GET["img"])){
header('Location: http://images.punyman.com/uploads/error.png');
}
if (isset($_GET["raw"])){
$image = file_get_contents("uploads/".$_GET["img"].".png");
header('content-type: image/png');
echo $image;
return;
}
?>
<!DOCTYPE HTML>
<HTML>
<head>
<title><?php echo $_GET["img"];?>.png</title>
<meta name="description" content="<?php echo $_GET["img"];?>.png - Powered by Gyazo">
<link href='http://fonts.googleapis.com/css?family=Roboto+Condensed:300' rel='stylesheet' type='text/css'>
<style>
body{
background: #636363;
overflow: hidden;
}
img{
background: #ffffff;
-webkit-box-shadow: 0 0 20px #000;
box-shadow: 0 0 20px #000;
border: 10px solid #e3e3e3;
outline: 1px solid #ffffff;
position: absolute;
top:0;
bottom: 0;
left: 0;
right: 0;
margin: auto;
}
a:link {color:#D8D8D8;}
a:visited {color:#BDBDBD;}
footer {
color: #e3e3e3;
font-family: 'Roboto Condensed', sans-serif;
margin: 0 auto;
position:absolute;
bottom:10px;
height:20px; /* Height of the footer */
width: 100%;
display:inline-block;
}
#footer-left{
position: absolute;
text-align: left;
left: 0;
}
#footer-right{
position: absolute;
text-align: right;
right: 17px;
}
</style>
</head>
<body>
<img src="/uploads/<?php echo $_GET["img"];?>.png"/>
<footer>
<span id="footer-left">
Created by <a href="http://github.com/ron975/">Ronny Chan</a>
</span>
<span id="footer-right">
Powered by <a href="http://gyazo.com/">Gyazo</a>
</span>
</div>
</body>
</HTML>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment