Prueba de logs

parent 8b0bfca5
......@@ -61,16 +61,15 @@ class DefaultController extends Controller {
if ($uploadFile == true) {//foto subida
$file = $request->files->get('imagen');
if (empty($file)) {
return new JsonResponse(array("msg" => "No se subio una imagen", "tipo" => UsuarioNutrapharm::ESTADO_FOTO_INICIAL), Response::HTTP_BAD_REQUEST, ['content-type' => 'application/json']);
}
} else {//foto tomada
$file = $request->get("imagen", null);
}
$log->debug("guardando datos de ip $ip...");
if ($uploadFile == true && empty($file)) {
return new JsonResponse(array("msg" => "No se subio una imagen", "tipo" => UsuarioNutrapharm::ESTADO_FOTO_INICIAL), Response::HTTP_BAD_REQUEST, ['content-type' => 'application/json']);
}
if ($tipo == UsuarioNutrapharm::ESTADO_FOTO_INICIAL) { //Usuario Nuevo
$usuarioNutraPharm = new UsuarioNutrapharm();
......@@ -82,7 +81,7 @@ class DefaultController extends Controller {
$usuarioNutraPharm->setUnuEstado(UsuarioNutrapharm::ESTADO_FOTO_INICIAL);
$usuarioNutraPharm->setUnuEliminado(UsuarioNutrapharm::ELIMINADO_FALSE);
$usuarioNutraPharm->save();
$uploadDir = $this->getParameter('upload_dir');
$idNutrapharm = explode("@", $usuarioNutraPharm->getUnuCorreo())[0] . $usuarioNutraPharm->getUnuId();
......@@ -90,11 +89,11 @@ class DefaultController extends Controller {
$usuarioNutraPharm->setUnuIdNutrapharm($idNutrapharm);
$usuarioNutraPharm->setUnuExtInicial($file->getClientOriginalExtension());
$usuarioNutraPharm->save();
if($uploadFile){
if ($uploadFile) {
$filename = $idNutrapharm . "." . $file->getClientOriginalExtension();
$file->move($uploadDir, $filename);
}else{
} else {
$data = $this->getBase64Image($file);
file_put_contents("$filename.$data[1]", $data[0]);
}
......@@ -117,10 +116,10 @@ class DefaultController extends Controller {
$usuarioNutraPharm->setUnuExtInicial($file->getClientOriginalExtension());
$usuarioNutraPharm->save();
$filename = $idNutrapharm . "." . $file->getClientOriginalExtension();
if($uploadFile){
if ($uploadFile) {
$filename = $idNutrapharm . "." . $file->getClientOriginalExtension();
$file->move($uploadDir, $filename);
}else{
} else {
$data = $this->getBase64Image($file);
file_put_contents("$filename.$data[1]", $data[0]);
}
......@@ -188,8 +187,7 @@ class DefaultController extends Controller {
}
//file_put_contents("img.{$type}", $data);
return array($data,$type);
return array($data, $type);
}
protected function getMimeType($file) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment