Estoy seguro de ke lo ke hago es correcto y no entiendo pk no funciona. aki dejo el primer php ke extrae la id de una fila y la almacena en una variable de sesion llamada id esta al final del archivo
Código PHP:
<?php
include ("includes/config.php");
include ("includes/funciones.php");
session_start();
unset($_SESSION['xml']);
unset($_SESSION['id']);
$usuario = $_POST['username'];
$xml= time();
$fin=".xml";
$xmls= $usuario.$xml.$fin;
$_SESSION['xml'] = $xmls;
if (isset($_SESSION['usuario'])) {//esta variable de sesion funciona
$fotografo= $_SESSION['usuario'];//esta variable de sesion funciona
$cnx=conectar();
$query2=mysql_query("INSERT INTO evento(id_evento,fotografo,cliente,fecha_alta,xml)VALUES "."('','$fotografo','$usuario','','$xmls')");
}
mysql_close($cnx);
$cnx=conectar();
$query3=mysql_query("SELECT id_evento FROM evento WHERE xml='$xmls'");
$row = mysql_fetch_array($query3);
$id_usuario= $row['id_evento'];
$_SESSION['id']=$id_usuario;//aki no se ke pasa pero no guarda la variable de sesion.
}
?>
Código PHP:
<?
include ("includes/config.php");
include ("includes/funciones.php");
session_start();
$cnx=conectar();
$id= $_SESSION['id'];//aki no guarda nada y no entiendo pk
if ($_FILES['Filedata']['name']) {
//$nuevoNombre = time().".jpg";
$size = 150; // the thumbnail height
$filedir = 'hola/'; // the directory for the original image
$thumbdir = 'hola/'; // the directory for the thumbnail image
$prefix = 'small_';
$prefix1 = 'BIG_'; // the prefix to be added to the original name
$maxfile = '2000000';
$mode = '0666';
$userfile_name = $_FILES['Filedata']['name'];
$userfile_tmp = $_FILES['Filedata']['tmp_name'];
$userfile_size = $_FILES['Filedata']['size'];
$userfile_type = $_FILES['Filedata']['type'];
if (isset($_FILES['Filedata']['name']))
{
$prod_img = $filedir.$userfile_name;
$nuevoNombre = time();
$prod_img_thumb = $thumbdir.$prefix.$nuevoNombre.$userfile_name;
$prod_img_thumb1 = $thumbdir.$prefix1.$nuevoNombre.$userfile_name;
move_uploaded_file($userfile_tmp, $prod_img);
chmod ($prod_img, octdec($mode));
$sizes = getimagesize($prod_img);
$aspect_ratio = $sizes[1]/$sizes[0];
if ($sizes[1] <= $sizes[0])
{
$new_width = 500;
$new_height = 500*$aspect_ratio = $sizes[1]/$sizes[0];
}else{
$new_height = 398;
$new_width = 398*$aspect_ratio1 = $sizes[0]/$sizes[1];
}
$new_width1 = 100;
$new_height1 = 100;
$destimg=imagecreatetruecolor($new_width,$new_height)
or die('Problem In Creating image');
$srcimg=imagecreatefromjpeg($prod_img)
or die('Problem In opening Source Image');
if(function_exists('imagecopyresampled'))
{
imagecopyresampled($destimg,$srcimg,0,0,0,0,$new_width,$new_height,ImageSX($srcimg),ImageSY($srcimg))
or die('Problem In resizing');
}else{
imagecopyresized($destimg,$srcimg,0,0,0,0,$new_width,$new_height,ImageSX($srcimg),ImageSY($srcimg))
or die('Problem In resizing');
}
imagejpeg($destimg,$prod_img_thumb,90)
//imagejpeg($destimg,$prod_img_thumb,90)
//imagejpeg($destimg,"hola",90);
or die('Problem In saving');
imagedestroy($destimg);
$destimg1=imagecreatetruecolor($new_width1,$new_height1)
or die('Problem In Creating image');
$srcimg1=imagecreatefromjpeg($prod_img)
or die('Problem In opening Source Image');
if(function_exists('imagecopyresampled'))
{
imagecopyresampled($destimg1,$srcimg1,0,0,0,0,$new_width1,$new_height1,ImageSX($srcimg1),ImageSY($srcimg1))
or die('Problem In resizing');
}else{
imagecopyresized($destimg1,$srcimg1,0,0,0,0,$new_width1,$new_height1,ImageSX($srcimg1),ImageSY($srcimg1))
or die('Problem In resizing');
}
imagejpeg($destimg1,$prod_img_thumb1,90)
//imagejpeg($destimg,$prod_img_thumb,90)
//imagejpeg($destimg,"hola",90);
or die('Problem In saving');
imagedestroy($destimg1);
}
@unlink($prod_img);
$query = mysql_query("INSERT INTO imagenes (id_evento,galeria,image_small,image_big) VALUES "
."('$id','1','$prod_img_thumb1','$prod_img_thumb')");
}
?>