The trick is to convert the bytes of image to string using this syntax:
ThumbnailPhotoString = "data:image/png;base64," + Convert.ToBase64String(product.ThumbnailPhoto),
Example:
foreach (var product in productDetail) { homePageProductDetailsDtos.Add( new HomePageProductDetailsDto() { Name = product.Name, Id = product.Id, ProductDescription = product.Description, ProductNumber = product.ProductNumber, ListPrice = product.ListPrice, SubCategoryId = product.ProductSubcategoryID, LargPhotoString = "data:image/png;base64," + Convert.ToBase64String(product.LargPhoto), ThumbnailPhotoString = "data:image/png;base64," + Convert.ToBase64String(product.ThumbnailPhoto), LargePhotoFileName = product.LargePhotoFileName, ThumbnailPhotoFileName = product.ThumbnailPhotoFileName, ThumbnailUrl = product.ThumbnailPhotoFileName }); }
No comments:
Post a Comment