AdminImage (Directive)
You can use the admin image module for user avatar together with gravatar.com and for project logos.
The feature of this module is the error handling: In case of a 404 error of the image source (img src) the module shows a default image-not-found image. Or a default user profile icon (type=user), or a default project icon (type=project).
Parameters
Name | Type | Description |
---|---|---|
image | string | source of the image: - in case of user (gr)avatar it's the e-mail address, - in case of project logo it's the image url |
type | string | type of image; you can use it with: - project - user |
Examples
User Avatar
HTML file
// Default user profile image
<img dspAdminImage [image]="imgDefaultUser" [type]="'user'" />
// Avatar example: 'salsah' user
<img dspAdminImage [image]="imgSalsahUser" [type]="'user'" />
// User image on error
<img dspAdminImage [image]="null" [type]="'user'" />
// Default error image
<img dspAdminImage [image]="'null'" />
Typescript file
imgDefaultUser: string = 'root@example.com';
imgSalsahUser: string = 'salsah@dasch.ch';
### Project Logo **HTML file**
// Default project image
<img dspAdminImage [image]="imgDefaultProject" [type]="'project'" />
// Logo example: 'dasch' project
<img dspAdminImage [image]="imgDaschProject" [type]="'project'" />
**Typescript file**
imgDefaultProject: string = undefined;
imgDaschProject: string = 'http://dasch.swiss/content/images/2017/11/DaSCH_Logo_RGB.png';
![Default project logos](../../assets/images/admin-image2.png)
Last update: 2021-08-13