src/Controller/MelisAuthController.php
public function getProfilePictureAction()
    {
        $melisCoreAuth = $this->serviceLocator->get('MelisCoreAuth');
        $moduleSvc = $this->getServiceLocator()->get('ModulesService');
        $user = $melisCoreAuth->getIdentity();
        $imageDefault = $moduleSvc->getModulePath('MelisCore') . '/public/images/profile/default_picture.jpg';

        if (!empty($user) && !empty($user->usr_image)) {
            $image = $user->usr_image;
        } else {
            $image = file_get_contents($imageDefault);
        }

        $response = $this->getResponse();

        $response->setContent($image);
        $response->getHeaders()
            ->addHeaderLine('Content-Transfer-Encoding', 'binary')
            ->addHeaderLine('Content-Type', 'image/jpg');

        return $response;
    }
public function getProfilePictureAction()
    {
        $melisCoreAuth = $this->serviceLocator->get('MelisCoreAuth');
        $moduleSvc = $this->getServiceLocator()->get('ModulesService');
        $user = $melisCoreAuth->getIdentity();
        $imageDefault = $moduleSvc->getModulePath('MelisCore') . '/public/images/profile/default_picture.jpg';

        if (!empty($user) && !empty($user->usr_image)) {
            $image = $user->usr_image;
        } else {
            $image = file_get_contents($imageDefault);
        }

        $response = $this->getResponse();

        $response->setContent($image);
        $response->getHeaders()
            ->addHeaderLine('Content-Transfer-Encoding', 'binary')
            ->addHeaderLine('Content-Type', 'image/jpg');

        return $response;
    }
public function getProfilePictureAction ( ) { $ melisCoreAuth = $ this -> serviceLocator -> get ( 'MelisCoreAuth' ) ; $ moduleSvc = $ this -> getServiceLocator ( ) -> get ( 'ModulesService' ) ; $ user = $ melisCoreAuth -> getIdentity ( ) ; $ imageDefault = $ moduleSvc -> getModulePath ( 'MelisCore' ) . '/public/images/profile/default_picture.jpg' ; if ( ! empty ( $ user ) && ! empty ( $ user -> usr_image ) ) { $ image = $ user -> usr_image ; } else { $ image = file_get_contents ( $ imageDefault ) ; } $ response = $ this -> getResponse ( ) ; $ response -> setContent ( $ image ) ; $ response -> getHeaders ( ) -> addHeaderLine ( 'Content-Transfer-Encoding' , 'binary' ) -> addHeaderLine ( 'Content-Type' , 'image/jpg' ) ; return $ response ; }
Get the profile picture

@return \Zend\Stdlib\ResponseInterface
Get the profile picture