showthumb.php3 920 Bytes
Newer Older
1 2 3
<?php
#
# EMULAB-COPYRIGHT
4
# Copyright (c) 2000-2004, 2007 University of Utah and the Flux Group.
5 6 7 8 9 10 11 12 13
# All rights reserved.
#
include("defs.php3");

#
# This script generates the contents of an image. No headers or footers,
# just spit back an image. The thumbs are public, so no checking is done.
# To obfuscate, do not use pid/eid, but rather use the resource index. 
#
14
$reqargs = RequiredPageArguments("idx", PAGEARG_INTEGER);
15 16 17 18 19 20 21

#
# Get the thumb from the DB. 
#
$query_result =
    DBQueryFatal("select thumbnail from experiment_resources ".
		 "where idx='$idx'");
22 23 24

if ($query_result && mysql_num_rows($query_result)) {
    $row  = mysql_fetch_array($query_result);
25
    $data = $row["thumbnail"];
26 27 28 29 30 31

    if (strlen($data)) {
	header("Content-type: image/png");
	echo "$data";
	return;
    }
32
}
33 34 35 36

# No Data. Spit back a stub image.
header("Content-type: image/gif");
readfile("coming-soon-thumb.gif");
37 38 39 40 41

#
# No Footer!
# 
?>