Image URL creation in client app



image URL:s are generated by doing the following:

@if (Model.Basics.Image?.Length > 0)
                    <img src="@Model.BuildImageUrl(Model.Basics.Image[0])?width=512&height=516&mode=Crop" alt="@Model.Basics.FirstName @Model.Basics.LastName" class="pull-left" />
                    <img src="assets/images/placeholder.jpg" alt="@Model.Basics.FirstName @Model.Basics.LastName" class="pull-left" />

The BuildImageUrl Func is used. I managed to declare and initialize it in my Razor Pages Page Model by creating a constructor and passing in SquidexOptions.

Now when I take a look at the generated URL it looks like this:

<img src="/api/assets/813d1a8a-604b-43f9-84ad-2f4152af76fa?width=50&height=50&mode=Crop" />

Looks OK except that it is relative to the client application and not the CMS. If I put the protocol and domain name of my CMS it is obviously going to work. But how can I achieve this in a nice clean way?

The sample is outdated, I would use the following method:

I will update the sample.

I have updated the sample

Thanks for the quick reply Sebastian.

I got it working - I had missed to configure the Squidex middleware in Startup.cs ;s