function handleJSON_getImage($smarty, $module_name) { global $arrCredentials; global $arrConf; $pDB = new paloDB($arrConf['elastix_dsn']["elastix"]); $pACL = new paloACL($pDB); $imgDefault = "/var/www/html/web/_common/images/Icon-user.png"; $id_user = getParameter("ID"); $picture = false; $picture = $pACL->getUserPicture($id_user); // Creamos la imagen a partir de un fichero existente if ($picture != false && !empty($picture["picture_type"])) { Header("Content-type: {$picture["picture_type"]}"); print $picture["picture_content"]; } else { Header("Content-type: image/png"); $im = file_get_contents($imgDefault); echo $im; } return; }
function getImage($smarty, $module_name, $local_templates_dir, &$pDB, $arrConf, $arrCredentiasls) { $pACL = new paloACL($pDB); $imgDefault = $_SERVER['DOCUMENT_ROOT'] . "/admin/web/apps/{$module_name}/images/Icon-user.png"; $id_user = getParameter("ID"); $picture = false; if ($arrCredentiasls["userlevel"] == "superadmin") { $picture = $pACL->getUserPicture($id_user); } else { //verificamos que el usario pertenezca a la organizacion if ($pACL->userBellowOrganization($id_user, $arrCredentiasls["id_organization"])) { $picture = $pACL->getUserPicture($id_user); } } // Creamos la imagen a partir de un fichero existente if ($picture != false && !empty($picture["picture_type"])) { Header("Content-type: {$picture["picture_type"]}"); print $picture["picture_content"]; } else { Header("Content-type: image/png"); $im = file_get_contents($imgDefault); echo $im; } return; }