-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathview.php
More file actions
39 lines (35 loc) · 698 Bytes
/
view.php
File metadata and controls
39 lines (35 loc) · 698 Bytes
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
36
37
38
39
<?
ini_set('display_errors',1);
require('snaphax.php');
session_start();
$opts['username'] = $_SESSION['u'];
$opts['password'] = $_SESSION['p'];
$s=new Snaphax($opts);
$request = $s->login();
$requested_snap = Array();
foreach($request['snaps'] as $snap)
{
if($snap['id'] == $_GET['snap'])
{
$requested_snap = $snap;
break;
}
}
$blob = $s->fetch($requested_snap['id']);
if($blob)
{
if($requested_snap['m'] == SnapHax::MEDIA_IMAGE)
{
header('Content-Type: image/jpeg');
}
else
{
header('Content-Type: video/mp4');
}
print($blob);
}
else
{
header('Content-Type: image/png');
passthrough('convert -fill black label:"Error, something went wrong" png:-');
}