<?php
/*
 * This file is part of Web Pro Manager.
 * 
 * Web Pro Manager is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 * 
 * Web Pro Manager is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with Web Pro Manager.  If not, see <http://www.gnu.org/licenses/>.
 * 
 * @author The Web Pro Miami, Inc. <info@thewebpro.com>
 * @copyright The Web Pro Miami, Inc. <info@thewebpro.com>, http://www.thewebpro.com/
 * @license http://www.gnu.org/licenses/gpl.html GNU GPL
 * @package WebProManager
*/

require("inc/stop_cache.php");
$nAdminOnlyPg = 0;
require("inc/secure_page.php");
// connect to mysql
require("../inc/dbconnect.php");

// Get passed-in vars
$nRecID = (isset($_GET['id']) ? $_GET['id'] : NULL);
if(!$nRecID){ $nRecID = (isset($_POST['id']) ? $_POST['id'] : NULL); }
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>
<head>
	<title><?php echo _("Preview"); ?></title>
</head>

<body bgcolor="#000000">

<div align="center"><?php echo nGetImage($nRecID)?></div>

</body>
</html>
<?php
function nGetImage($nRecID){
	global $DBName,$Link;
	$nSQL = "SELECT nPath FROM nImage WHERE nID='$nRecID' LIMIT 1";
	mysql_select_db($DBName); $Result = mysql_query($nSQL,$Link);
	if($Row = mysql_fetch_array($Result)){
		$nPath = $Row["nPath"];
	}
	$nImgTag = nGetImgTag("../".$nPath);
	return $nImgTag;
}
function nGetImgTag($nImgFile){
	if(!$nImgFile){ return; }
	$nImgTagARRAY = getimagesize($nImgFile);
	$nImgTagWH = $nImgTagARRAY[3];
	$nTag = "<img src=\"$nImgFile\" alt=\"\" $nImgTagWH border=\"0\">";
	return $nTag;
}
?>
<?php require("../inc/db_close.php"); ?>
