-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.php
35 lines (27 loc) · 989 Bytes
/
index.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
<?php
require_once 'config.php';
$param = $_GET['p'];
if (!preg_match('([^\.\s\\\/]+(\.(?i)(jpg|jpeg|png|gif))$)', $param)) {
die('Image not found.');
}
$img = IMAGE_DIR . $param;
if (strlen(strstr($_SERVER['HTTP_USER_AGENT'], "Twitterbot")) <= 0) {
$data = file_get_contents($img);
header('Content-type: image/'.pathinfo($img, PATHINFO_EXTENSION));
die($data);
}
echo '<!DOCTYPE html>
<html>
<head>
<title>pic.vanit.as</title>
<meta name="twitter:card" content="summary_large_image">
<meta name="twitter:site" content="'.TWITTER_SITE.'">
<meta name="twitter:creator" content="'.TWITTER_CREATOR.'">
<meta name="twitter:title" content="Image shared via pic.vanit.as">
<meta name="twitter:description" content="This image has been shared via a self-hosted service on vanit.as">
<meta name="twitter:image" content="'.BASE_URL.$img.'">
</head>
<body>
<img src="'.$img.'">
</body>
</html>';