Skip to content

Issues fetching Images inside Page Models #1722

Answered by gmullernh
gmullernh asked this question in Q&A
Discussion options

You must be logged in to vote

Solved! Indeed, I was forgetting something.
While fetching the GetPublicUrl for a image model, the service was looking for an IStorage service.
None was found, so a Null Exception was being thrown.
Since the API doesn't save files, adding the package Piranha.Local.FileStorage and using a FileStorage with only a baseUrl solved the issue.

At startup.cs

public void ConfigureServices(IServiceCollection services)
{
    services.AddPiranha(options =>
    {
        options.UseFileStorage(baseUrl: "https://example.org/files/");
    }
}

Packages reference.

    <PackageReference Include="Piranha.Data.EF.SQLite" Version="9.1.0" />
    <PackageReference Include="Piranha" Version="9.1.1" />
    <Packa…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by gmullernh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant