Problem with variable $ _SESSION

0

I have this function, which does not recognize me $_SESSION['id_usuario'] variable%, showing me the indefinite and the question is if there is, as I am using it in other functions.

public function mostrarImagenController($datos){

    list($ancho,$alto)=getimagesize($datos);

    if ($ancho < 1024 ||$alto < 768) {

        echo 0;

    }else{
        $aleatorio=mt_rand(100,999);
        $ruta="../../views/imagest/galeria/galeria".$aleatorio.".jpg";
        $nuevo_ancho=1024;
        $nuevo_alto=768;

        $origen=imagecreatefromjpeg($datos);

        #imagecreatetruecolor — Crear una nueva imagen de color verdadero
        $destino=imagecreatetruecolor($nuevo_ancho, $nuevo_alto);

        #imagecopyresized() - copia una porción de una imagen a otra imagen. 

        #bool imagecopyresized( $destino, $origen, int $destino_x, int $destino_y, int $origen_x, int $origen_y, int $destino_w, int $destino_h, int $origen_w, int $origen_h)

        imagecopyresized($destino, $origen, 0, 0, 0, 0, $nuevo_ancho, $nuevo_alto, $ancho, $alto);

        imagejpeg($destino,$ruta);

        $id_tienda5=$_SESSION['id_usuario'];
        $datosController=array("ruta"=>$ruta,
                                "id"=>$id_tienda5);

        DatosTienda::subirImagengaleriaModel($datosController,"tiendas_cafe");
        $respuesta=DatosTienda::mostrarImagengaleriaModel($datosController,"tiendas_cafe");

        echo $respuesta['img_galeria_tienda'];

    }

}
    
asked by jorgnv 23.08.2017 в 19:46
source

1 answer

2

so I'm looking at the code, at no time are you calling session_star (), or you're not including it, unless within the php document in the header this

<?php
session_start();
public function mostrarImagenController($datos){.....

the other thing that can be is that the session has another name.

    
answered by 23.08.2017 в 21:18