Store URL instead of blob

This commit is contained in:
2025-06-28 12:00:35 -07:00
parent 573597769b
commit 4b5d3238b5
3 changed files with 4 additions and 8 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: Blob = new Blob; imageSrc: string = "";
} }
@@ -5,8 +5,8 @@
<button class="gameCard-Prev" onclick=""></button> <button class="gameCard-Prev" onclick=""></button>
<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 && product.images[product.curShowingIMG]?.imageSrc" >
<img class="gameCard-Img" [src]="createImageUrl(product.images[product.curShowingIMG].imageSrc)"> <img class="gameCard-Img" [src]="product.images[product.curShowingIMG].imageSrc">
</div> </div>
</div> </div>
<h1 class ="gameCard-Name">{{ product.name }}</h1> <h1 class ="gameCard-Name">{{ product.name }}</h1>
@@ -30,7 +30,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 = blob; img.imageSrc = URL.createObjectURL(blob);
this.cdr.detectChanges(); this.cdr.detectChanges();
}); });
}); });
@@ -39,8 +39,4 @@ export class CatalogComponent {
} }
) )
}; };
createImageUrl(blob: Blob): string {
return URL.createObjectURL(blob);
}
} }