<?php
session_start();
include('../db.php');

if (!session_is_registered("clave_audio")) {
	include("../login.php");
	if (!$continuar) exit;
}
?>
<html>
<head>
<title>imagenes</title>
<link href="../sformi.css" rel="stylesheet" type="text/css">
<script language="JavaScript" type="text/JavaScript">
function doSubmit() { 
	document.formulario.submit();
}
</script>
</head>
<body>
<?php 

/*
if (!session_is_registered("sintogeo")) {
	include("../login.php");
	if (!$continuar) exit;
}
*/

if(isset($_REQUEST['op'])) {
	$operacion = $_REQUEST['op'];
	$id = $_REQUEST['id'];
} else {
	$operacion = "add";
}

?>
<?php
switch($operacion)
{
	case "add";
		$imagen_id = "";
$imagen_filepath = "";
$imagen_thumbpath = "";
$imagen_url = "";
$imagen_pie = "";
$imagen_metadata = "";
$imagen_width = "";
$imagen_height = "";

		break;

	case "edit";
		$conn = db_connect();
		if($conn) {
			$query = "SELECT imagen_id, imagen_id, imagen_filepath, imagen_thumbpath, imagen_url, imagen_pie, imagen_metadata, imagen_width, imagen_height FROM edito_imagenes WHERE imagen_id = " . $id;
			$result = mysql_query($query, $conn);
			if (mysql_num_rows($result)) {
				$row = mysql_fetch_array($result);
				$imagen_id = $row['imagen_id'];
$imagen_filepath = $row['imagen_filepath'];
$imagen_thumbpath = $row['imagen_thumbpath'];
$imagen_url = $row['imagen_url'];
$imagen_pie = $row['imagen_pie'];
$imagen_metadata = $row['imagen_metadata'];
$imagen_width = $row['imagen_width'];
$imagen_height = $row['imagen_height'];

			} else {
				$imagen_id = "";
$imagen_filepath = "";
$imagen_thumbpath = "";
$imagen_url = "";
$imagen_pie = "";
$imagen_metadata = "";
$imagen_width = "";
$imagen_height = "";

			}
		}
		break;
}
?>
<form method="post" action="imagenes_db.php" name="formulario">
<input name="op" type="hidden" value="<?php echo $operacion; ?>">
<input name="id" type="hidden" value="<?php echo $id; ?>">
<table border="0" cellspacing="0" cellpadding="0">
	<tr><td width="200" class= "lbl">Imagen Id</td></tr>
<tr><td width="" class="data"><input name="imagen_id" type="text" size="" maxlength="" value="<?php echo $imagen_id; ?>"></td></tr>
<tr><td><img src="_imgs/d.gif" width="100" height="10"></td></tr>
<tr><td width="200" class= "lbl">Archivo</td></tr>
<tr><td width="" class="data"><input name="imagen_filepath" type="file"></td></tr>
<tr><td><img src="_imgs/d.gif" width="100" height="10"></td></tr>
<tr><td width="200" class= "lbl">Thumbnail</td></tr>
<tr><td width="" class="data"><input name="imagen_thumbpath" type="text" size="80" maxlength="255" value="<?php echo $imagen_thumbpath; ?>"></td></tr>
<tr><td><img src="_imgs/d.gif" width="100" height="10"></td></tr>
<tr><td width="200" class= "lbl">URL</td></tr>
<tr><td width="" class="data"><input name="imagen_url" type="text" size="80" maxlength="" value="<?php echo $imagen_url; ?>"></td></tr>
<tr><td><img src="_imgs/d.gif" width="100" height="10"></td></tr>
<tr><td width="200" class= "lbl">Pie</td></tr>
<tr><td width="" class="data"><input name="imagen_pie" type="text" size="80" maxlength="" value="<?php echo $imagen_pie; ?>"></td></tr>
<tr><td><img src="_imgs/d.gif" width="100" height="10"></td></tr>
<tr><td width="200" class= "lbl">Metadata</td></tr>
<tr><td width="" class="data"><input name="imagen_metadata" type="text" size="80" maxlength="" value="<?php echo $imagen_metadata; ?>"></td></tr>
<tr><td><img src="_imgs/d.gif" width="100" height="10"></td></tr>
<tr><td width="200" class= "lbl">Ancho</td></tr>
<tr><td width="" class="data"><input name="imagen_width" type="text" size="6" maxlength="6" value="<?php echo $imagen_width; ?>"></td></tr>
<tr><td><img src="_imgs/d.gif" width="100" height="10"></td></tr>
<tr><td width="200" class= "lbl">Alto</td></tr>
<tr><td width="" class="data"><input name="imagen_height" type="text" size="6" maxlength="6" value="<?php echo $imagen_height; ?>"></td></tr>
<tr><td><img src="_imgs/d.gif" width="100" height="10"></td></tr>

</table>
<table border="0" cellspacing="0" cellpadding="0">
	<tr>
	  <td>
		<a href="javascript:history.go(-1)" class="button">[ back ]</a>&nbsp;&nbsp;
		<a href="javascript:doSubmit();" class="button">[ <?php echo $operacion; ?> ]</a>
	</td>
	</tr>
</table>
</form>
</body>
</html>