0e52d2c02049becb5e1d249849e95d1e93eb936f
[ealt-edge.git] / example-apps / PDD / frontend-src / src / app / pcbimages / pcbimages.component.ts
1 import { Component, OnInit } from '@angular/core';
2
3 import { EaltserviceService } from '../ealtservice.service'
4
5 import { DomSanitizer, SafeUrl } from "@angular/platform-browser";
6
7 @Component({
8   selector: 'app-pcbimages',
9   templateUrl: './pcbimages.component.html',
10   styleUrls: ['./pcbimages.component.scss']
11 })
12 export class PcbimagesComponent implements OnInit {
13
14   input_images = ["./../../assets/images/input_images/01_spurious_copper_03.jpg","./../../assets/images/input_images/04_missing_hole_04.jpg","./../../assets/images/input_images/07_spurious_copper_05.jpg","./../../assets/images/input_images/09_missing_hole_04.jpg","./../../assets/images/input_images/09_spurious_copper_09.jpg","./../../assets/images/input_images/11_open_circuit_03.jpg"];
15   inputimg = true;
16
17   thumbnail01 : any;
18   thumbnail02 : any;
19   thumbnail03 : any;
20   thumbnail04 : any;
21   thumbnail05 : any;
22   thumbnail : any;
23   data: any;
24
25   cam: any;
26   edge: any;
27
28   constructor(
29     private serviceobj: EaltserviceService,
30     private sanitizer: DomSanitizer
31   ) { }
32
33   ngOnInit(): void {
34     // this.inputimg == false;
35     // this.getImage(this.data);
36     this.cam = JSON.parse(localStorage.getItem('camera'));
37     this.edge = JSON.parse(localStorage.getItem('edgesite'));
38     this.data = this.edge + '/' + this.cam;
39
40     this.getImage(this.data);
41   }
42
43   getImage(data) {
44
45     //let myCompOneObj = new CompOneComponent();
46     debugger;
47     this.serviceobj.getInputImage(data)
48         .subscribe( (data:any) => {
49           
50       debugger;
51
52       let objectURL = 'data:image/jpeg;base64,' + data.image01;
53       this.thumbnail = this.sanitizer.bypassSecurityTrustUrl(objectURL);
54       
55       // let objectURL01 = 'data:image/jpeg;base64,' + data.image01;
56       let objectURL02 = 'data:image/jpeg;base64,' + data.image02;
57       let objectURL03 = 'data:image/jpeg;base64,' + data.image03;
58       let objectURL04 = 'data:image/jpeg;base64,' + data.image04;
59       let objectURL05 = 'data:image/jpeg;base64,' + data.image05;
60
61
62       // this.thumbnail01 = this.sanitizer.bypassSecurityTrustUrl(objectURL01);
63       this.thumbnail02 = this.sanitizer.bypassSecurityTrustUrl(objectURL02);
64       this.thumbnail03 = this.sanitizer.bypassSecurityTrustUrl(objectURL03);
65       this.thumbnail04 = this.sanitizer.bypassSecurityTrustUrl(objectURL04);
66       this.thumbnail05 = this.sanitizer.bypassSecurityTrustUrl(objectURL05);
67
68      },
69      error => console.log(error));    
70
71   }
72
73 }