forked from open-webui/open-webui
		
	feat: initial avatar set to first letter of firstname, first letter of lastname
This commit is contained in:
		
							parent
							
								
									a2bd9b8639
								
							
						
					
					
						commit
						c52cc46d2c
					
				
					 1 changed files with 4 additions and 4 deletions
				
			
		|  | @ -109,10 +109,10 @@ export const generateInitialsImage = (name) => { | |||
| 	ctx.font = '40px Helvetica'; | ||||
| 	ctx.textAlign = 'center'; | ||||
| 	ctx.textBaseline = 'middle'; | ||||
| 	const initials = name | ||||
| 		.split(' ') | ||||
| 		.map((word) => word[0]) | ||||
| 		.join(''); | ||||
| 	const firstNameInitial = name[0]; | ||||
| 	const lastNameInitial = name.lastIndexOf(' ') > -1 ? name[name.lastIndexOf(' ') + 1] : ''; | ||||
|     const initials = `${firstNameInitial}${lastNameInitial}`.toUpperCase() | ||||
| 	 | ||||
| 	ctx.fillText(initials.toUpperCase(), canvas.width / 2, canvas.height / 2); | ||||
| 
 | ||||
| 	return canvas.toDataURL(); | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Danny Liu
						Danny Liu