| 
									
										
										
										
											2021-01-06 02:21:50 +01:00
										 |  |  | import Constants from "../../Models/Constants"; | 
					
						
							|  |  |  | import {Utils} from "../../Utils"; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-01-03 00:19:42 +01:00
										 |  |  | export default class Img { | 
					
						
							| 
									
										
										
										
											2020-08-08 17:50:43 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-11-06 03:17:27 +01:00
										 |  |  |     public static runningFromConsole = false; | 
					
						
							| 
									
										
										
										
											2021-01-20 21:48:47 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-11-05 12:28:02 +01:00
										 |  |  |    static AsData(source:string){ | 
					
						
							| 
									
										
										
										
											2021-01-06 02:21:50 +01:00
										 |  |  |        if(Utils.runningFromConsole){ | 
					
						
							| 
									
										
										
										
											2020-11-06 03:17:27 +01:00
										 |  |  |            return source; | 
					
						
							|  |  |  |        } | 
					
						
							| 
									
										
										
										
											2020-11-05 12:28:02 +01:00
										 |  |  |        return `data:image/svg+xml;base64,${(btoa(source))}`; | 
					
						
							|  |  |  |    } | 
					
						
							| 
									
										
										
										
											2021-01-20 21:48:47 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-02-20 03:29:55 +01:00
										 |  |  |     static AsImageElement(source: string, css_class: string = "", style=""): string{ | 
					
						
							|  |  |  |         return `<img class="${css_class}" style="${style}" alt="" src="${Img.AsData(source)}">`; | 
					
						
							| 
									
										
										
										
											2020-11-05 12:28:02 +01:00
										 |  |  |     } | 
					
						
							| 
									
										
										
										
											2020-06-27 03:06:51 +02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 |