} $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue); switch ($theType) { case "text": $theValue = $theValue != "" ? "'" . $theValue . "'" : "NULL"; break; case "long": case "int": $theValue = $theValue != "" ? intval($theValue) : "NULL"; break; case "double": $theValue = $theValue != "" ? doubleval($theValue) : "NULL"; break; case "date": $theValue = $theValue != "" ? "'" . $theValue . "'" : "NULL"; break; case "defined": $theValue = $theValue != "" ? $theDefinedValue : $theNotDefinedValue; break; } return $theValue; } } $colname_getImage = "-1"; if (isset($_GET['image_id'])) { $colname_getImage = $_GET['image_id']; } $pictureDAO = new PictureDAO(); $picture = $pictureDAO->getPictureById($colname_getImage); header('Content-type: ' . $picture->fileType); echo $picture->payload;