-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathget-thumb.php
More file actions
executable file
·39 lines (32 loc) · 1.14 KB
/
Copy pathget-thumb.php
File metadata and controls
executable file
·39 lines (32 loc) · 1.14 KB
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
<?php
/* include header */
include("header.php");
/* get image id */
$id = isset($_GET['id']) ? $_GET['id'] : 0;
/* get size */
$size = isset($_GET['size']) ? $_GET['size'] : "Small";
/* check if image exists in database */
$q = "SELECT * FROM uploads WHERE file_id = '{$id}' LIMIT 1";
if(!sql_num_rows($q))
{
header('Content-Type: image/gif');
header('Content-Disposition: inline; filename=image_not_found.gif');
@readfile($config['base_path'] . "/assets/images/image_not_found.gif");
}else
/* check if image exists on server */
$image = sql_row($q);
if(!file_exists($config['upload_path'] . "thumb" . $size . "_" . $image['file_name']))
{
header('Content-Type: image/gif');
header('Content-Disposition: inline; filename=image_not_found.gif');
@readfile($config['base_path'] . "/assets/images/image_not_found.gif");
}else
/* display image */
if(sql_num_rows($q))
{
$image = sql_row($q);
header('Content-Type: '. $image['file_type']);
header('Content-Disposition: inline; filename='. "thumb" . $size . "_" . $image['file_name']);
@readfile($config['upload_path'] . "thumb" . $size . "_" . $image['file_name']);
}
?>