Skip to content
This repository has been archived by the owner on Jul 12, 2024. It is now read-only.

Commit

Permalink
fix: image null problem
Browse files Browse the repository at this point in the history
  • Loading branch information
foxminchan committed Jun 9, 2024
1 parent 4d2c0f8 commit 69af4e3
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ public interface IAzuriteService
{
Task<string> UploadFileAsync(IFormFile file, CancellationToken cancellationToken = default);
Task DeleteFileAsync(string fileName, CancellationToken cancellationToken = default);
string GetFileUrl(string? fileName);
string? GetFileUrl(string? fileName);
}
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,10 @@ public async Task DeleteFileAsync(string fileName, CancellationToken cancellatio
cancellationToken);
}

public string GetFileUrl(string? fileName)
public string? GetFileUrl(string? fileName)
{
if (string.IsNullOrWhiteSpace(fileName))
return string.Empty;
return null;

var blobClient = _container.GetBlobClient(fileName);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,11 @@ else
{
<div class="group relative">
<div class="aspect-h-1 aspect-w-1 w-full overflow-hidden rounded-md bg-gray-200 lg:aspect-none group-hover:opacity-75">
<img asp-append-version="true" loading="lazy" src="@(product.ImageUrl ?? "~/imgs/product/default-preview-image.png")" alt="@product.Name" class="h-full w-full lg:h-full lg:w-full object-cover object-center">
<img asp-append-version="true"
loading="lazy"
src="@(product.ImageUrl ?? "~/imgs/product/default-preview-image.png")"
alt="@product.Name"
class="h-full w-full lg:h-full lg:w-full object-cover object-center lg:object-cover lg:object-center" />
</div>
<div class="mt-4 flex justify-between">
<div>
Expand Down
8 changes: 8 additions & 0 deletions src/RookieShop.StoreFront/wwwroot/css/output.css
Original file line number Diff line number Diff line change
Expand Up @@ -2803,6 +2803,14 @@ video {
margin-left: calc(2rem * calc(1 - var(--tw-space-x-reverse)));
}

.lg\:object-cover {
object-fit: cover;
}

.lg\:object-center {
object-position: center;
}

.lg\:px-28 {
padding-left: 7rem;
padding-right: 7rem;
Expand Down

0 comments on commit 69af4e3

Please sign in to comment.