/** * Shows a members picture in different sizes * */ public function showAvatar($memberId = false) { $file = (int) $memberId; if (isset($_GET)) { if (isset($_GET['xs']) or isset($_GET['50_50'])) { $suffix = '_xs'; } elseif (isset($_GET['30_30'])) { $suffix = '_30_30'; } elseif (isset($_GET['150'])) { $suffix = '_150'; } elseif (isset($_GET['200'])) { $suffix = '_200'; } elseif (isset($_GET['500'])) { $suffix = '_500'; } else { $suffix = ''; } $file .= $suffix; } $member = $this->createEntity('Member', $memberId); $browseable = $member->isBrowsable(); if (!$browseable || !$this->hasAvatar($memberId, $suffix) || !$member->publicProfile && !$this->getLoggedInMember()) { header('Content-type: image/png'); @copy(HTDOCS_BASE . 'images/misc/empty_avatar' . (isset($suffix) ? $suffix : '') . '.png', 'php://output'); PPHP::PExit(); } $img = new MOD_images_Image($this->avatarDir->dirName() . '/' . $file); if (!$img->isImage()) { header('Content-type: image/png'); @copy(HTDOCS_BASE . 'images/misc/empty_avatar' . (isset($suffix) ? $suffix : '') . '.png', 'php://output'); PPHP::PExit(); } header('Content-type: ' . $img->getMimetype()); $this->avatarDir->readFile($file); PPHP::PExit(); }
/** * sends headers, reads out an image and then exits * * @param int $id - id of group to get thumbnail for * @access public */ public function realImg($id) { if (!($group = $this->createEntity('Group')->findById($id)) || !$group->Picture) { PPHP::PExit(); } $dir = new PDataDir('groups'); if (!$dir->fileExists($group->Picture) || $dir->file_Size($group->Picture) == 0) { PPHP::PExit(); } $img = new MOD_images_Image($dir->dirName() . '/' . $group->Picture); header('Content-type: ' . $img->getMimetype()); $dir->readFile($group->Picture); PPHP::PExit(); }