Incidentally, instead of this:
if (mysql_num_rows($result) ==1) {
$data = mysql_result($result,0,"thumbnail4");
$type = mysql_result($result,0,"thumbnailtype4");
Header( "Content-type: $type");
print $data;
}
It would have been a little easier to write:
if ($row = mysql_fetch_assoc($result)) {
header('Content-type: ' . $row['thumbnailtype4']);
echo $row['thumbnail4'];
}
Other minor improvements include using <?php instead of <?, using a defined constant for the error_reporting() argument instead of the magic number 7, and leaving out superfluous parentheses, e.g.,
$file = ('../pix/noimage.png');
$source = (fread(fopen($file, "r"), filesize($file)));
should be:
$file = '../pix/noimage.png';
$source = fread(fopen($file, "r"), filesize($file));
Actually, instead of fopen() and fread() you probably should just use [man]file_get_contents/man.