Move around BLOB

This commit is contained in:
2025-06-28 11:50:00 -07:00
parent 75917d9d65
commit 2c33ae64c1
3 changed files with 7 additions and 3 deletions
@@ -11,5 +11,5 @@ export class Product {
export class ProductImage { export class ProductImage {
imageID: number = 0; imageID: number = 0;
productID: number = 0; productID: number = 0;
imageSrc: string = ""; imageSrc: Blob = new Blob;
} }
@@ -6,7 +6,7 @@
<button class="gameCard-Next" onclick=""></button> <button class="gameCard-Next" onclick=""></button>
</div> </div>
<div *ngIf="product.images.length > 0" > <div *ngIf="product.images.length > 0" >
<img class="gameCard-Img" [src]="product.images[product.curShowingIMG].imageSrc"> <img class="gameCard-Img" [src]="createImageUrl(product.images[product.curShowingIMG].imageSrc)">
</div> </div>
</div> </div>
<h1 class ="gameCard-Name">{{ product.name }}</h1> <h1 class ="gameCard-Name">{{ product.name }}</h1>
@@ -29,7 +29,7 @@ export class CatalogComponent {
this.Products.forEach(item => { this.Products.forEach(item => {
item.images.forEach(img => { item.images.forEach(img => {
http.get("https://mistox.com/api/productimage/get?ProductID=" + img.productID + "&ImageID=" + img.imageID, { responseType: 'blob' }).subscribe(blob => { http.get("https://mistox.com/api/productimage/get?ProductID=" + img.productID + "&ImageID=" + img.imageID, { responseType: 'blob' }).subscribe(blob => {
img.imageSrc = URL.createObjectURL(blob); img.imageSrc = blob;
}); });
}); });
}); });
@@ -37,4 +37,8 @@ export class CatalogComponent {
} }
) )
}; };
createImageUrl(blob: Blob): string {
return URL.createObjectURL(blob);
}
} }