feat: added thumbnail middleware (idk if it works tho)

This commit is contained in:
limited_dev 2023-02-15 14:01:39 +01:00
parent b25949a8f3
commit 6a1287495d
5 changed files with 33 additions and 4 deletions

View file

@ -8,6 +8,7 @@
<ItemGroup>
<PackageReference Include="BCrypt.Net-Next" Version="4.0.3" />
<PackageReference Include="ImageThumbnail.AspNetCore.Middleware" Version="1.0.1" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="6.0.13" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="6.0.13">
<PrivateAssets>all</PrivateAssets>
@ -25,9 +26,31 @@
<Folder Include="wwwroot\img\dynamic\comment\tec" />
<Folder Include="wwwroot\img\dynamic\comment\vg" />
<Folder Include="wwwroot\img\dynamic\op\art" />
<Folder Include="wwwroot\img\dynamic\op\m" />
<Folder Include="wwwroot\img\dynamic\op\tec" />
<Folder Include="wwwroot\img\dynamic\op\vg" />
<Folder Include="wwwroot\img\thumb" />
</ItemGroup>
<ItemGroup>
<_ContentIncludedByDefault Remove="wwwroot\img\dynamic\op\m\zh5hrb0h.srp.jpg" />
<_ContentIncludedByDefault Remove="wwwroot\img\static\banned\1.png" />
<_ContentIncludedByDefault Remove="wwwroot\img\static\banned\10.png" />
<_ContentIncludedByDefault Remove="wwwroot\img\static\banned\2.png" />
<_ContentIncludedByDefault Remove="wwwroot\img\static\banned\3.png" />
<_ContentIncludedByDefault Remove="wwwroot\img\static\banned\4.png" />
<_ContentIncludedByDefault Remove="wwwroot\img\static\banned\5.png" />
<_ContentIncludedByDefault Remove="wwwroot\img\static\banned\6.png" />
<_ContentIncludedByDefault Remove="wwwroot\img\static\banned\7.png" />
<_ContentIncludedByDefault Remove="wwwroot\img\static\banned\8.png" />
<_ContentIncludedByDefault Remove="wwwroot\img\static\banned\9.png" />
<_ContentIncludedByDefault Remove="wwwroot\img\static\banner\art ban.png" />
<_ContentIncludedByDefault Remove="wwwroot\img\static\banner\m ban.png" />
<_ContentIncludedByDefault Remove="wwwroot\img\static\banner\tec ban.png" />
<_ContentIncludedByDefault Remove="wwwroot\img\static\deadlink\1.png" />
<_ContentIncludedByDefault Remove="wwwroot\img\static\err\1.png" />
<_ContentIncludedByDefault Remove="wwwroot\img\static\err\2.png" />
<_ContentIncludedByDefault Remove="wwwroot\img\static\err\3.png" />
<_ContentIncludedByDefault Remove="wwwroot\img\static\logo.png" />
</ItemGroup>
</Project>

View file

@ -1,5 +1,6 @@
using ImageBoardServerApp.Auth;
using ImageBoardServerApp.Data;
using ImageThumbnail.AspNetCore.Middleware;
using Microsoft.AspNetCore.Components.Authorization;
using Microsoft.AspNetCore.Components.Server.ProtectedBrowserStorage;
@ -38,4 +39,8 @@ using (var serviceScope = app.Services.CreateScope())
context.Database.EnsureCreated();
}
ImageThumbnailOptions options = new ImageThumbnailOptions("wwwroot/img/", "wwwroot/img/thumb");
options.ImageQuality = 75L;
app.UseImageThumbnail(options);
app.Run();

View file

@ -11,6 +11,7 @@
display: block;
margin-left: auto;
margin-right: auto;
max-width: 500px;
width: 500px;
max-height: 500px;
max-width: 90vw !important;
}

View file

@ -22,7 +22,7 @@
<div class="threadImage">
@if (image != null)
{
<img src="@($"{image.ImageLocation}")" alt="No Image found" />
<img src="@($"{image.ImageLocation}?size=258x258")" alt="No Image found" />
}
</div>
<div class="threadTextContainer">

View file

@ -34,7 +34,7 @@
<div class="threadImage">
@if (@post.Image != null)
{
<img src="@($"{@post.Image.ImageLocation}")" alt="No Image found" />
<img src="@($"{@post.Image.ImageLocation}?size=258x258")" alt="No Image found" />
}
else
{