Closed peter3 closed 2 years ago
At least one querystring command is needed for defaults to be applied. -> https://github.com/imazen/imageflow-dotnet-server/blob/ca7cb15717fc6cc5a2c1f59ba4f76598865666d0/src/Imageflow.Server/ImageJobInfo.cs#L222
You can apply such a default to all images by using the Imageflow rewriting method.
.AddRewriteHandler("/gallery", args => { //TODO: Set something if it isn't already set, on my phone here args.Query["watermark"] = "imazen"; })
Images uploaded to EPIServer aren't accessible to Imageflow unless you tell it how to get to them. There's an example adapter / blob service here: https://github.com/imazen/imageflow-dotnet-server/blob/main/examples/Imageflow.Server.Example/CustomBlobService.cs
I believe there are a few ImageResizer EPiServer adapters out there, but Imageflow needs one. Which version of EPIServer are you using?
On Sat, Jun 4, 2022, 4:12 AM Peter Törnqvist @.***> wrote:
I am trying out Imageflow on an episerver 12 site (local development so far) but have some issues with the Imageflow querystring API not triggering
I have the following packages installed:
<PackageReference Include="EPiServer.CMS" Version="12.7.0" /> <PackageReference Include="Imageflow.AllPlatforms" Version="0.8.1" /> <PackageReference Include="Imageflow.Server" Version="0.6.5" />
I have the following in Startup.Configure:
app.UseImageflow(new ImageflowMiddlewareOptions() .SetMapWebRoot(true) .AddCommandDefault("format", "webp") .AddCommandDefault("webp.quality", "80") .SetMyOpenSourceProjectUrl("https://github.com/xxxxx/xxxx") //.SetDefaultCacheControlString("public, max-age=2592000") ); app.UseStaticFiles(); app.UseRouting(); app.UseAuthentication(); app.UseAuthorization(); app.UseEndpoints(endpoints => { endpoints.MapContent(); //endpoints.MapDefaultControllerRoute(); // Imageflow test endpoint: endpoints.MapGet("/test-image", async context => { context.Response.ContentType = "text/html"; await context.Response.WriteAsync("<img src=\"test.jpg?width=450\" />"); }); });
- when I use the querystring API with an image uploaded to Episerver, the resize doesn't trigger: <img src=" https://localhost:5000/globalassets/1406-onebody_slide.jpg?width=100" alt="" />
- If I put the image url directly in the url field in the browser, the resize doesn't trigger: https://localhost:5000/globalassets/1406-onebody_slide.jpg?width=100
- If I try to access the https://localhost:5000/test-image url, the the resize doesn't trigger
- If I type in the test-image url directly in the browser, ie https://localhost:5000/test.jpg?width=450 the resizing does trigger
Additionally, the .AddCommandDefault()s are not applied in any of the test cases.
What am I doing wrong?
— Reply to this email directly, view it on GitHub https://github.com/imazen/imageflow-dotnet-server/issues/58, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAA2LH2NZOFYU35XV2K7ZZLVNMT2HANCNFSM5X3GWEPA . You are receiving this because you are subscribed to this thread.Message ID: @.***>
Thanks for the quick reply!
I have now implemented an IBlobProvider
for Episerver images and it seems to work very well. For some reason this also made https://localhost:5000/test-image
work, not sure why.
The only thing left is the .AddCommandDefault()
calls that doesn't add the default params to the url. I don't quite understand your reply regarding this, isn't "width" enough for the defaults to be applied?
Update: the .AddCommandDefault()
calls looks to be working now when I check the output from the webserver. Not sure what has changed, but anyway all my issues are resolved. Thanks
That's good to hear, I don't have any ideas why it might not have been working, width
would definitely trigger it. If you have the permission, would you be up for sharing the IBlobProvider implementation under Apache 2/MIT? I know there are other users who could benefit.
'Width' should definitely be enough for command defaults to be applied.
Could you share all your config code and versions?
On Tue, Jun 7, 2022, 3:44 AM Peter Törnqvist @.***> wrote:
Thanks for the quick reply!
I have now implemented an IBlobProvider for Episerver images and it seems to work very well. For some reason this also made https://localhost:5000/test-image work, not sure why.
The only thing left is the .AddCommandDefault() calls that doesn't add the default params to the url. I don't quite understand your reply regarding this, isn't "width" enough for the defaults to be applied?
— Reply to this email directly, view it on GitHub https://github.com/imazen/imageflow-dotnet-server/issues/58#issuecomment-1148442761, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAA2LHYNNJRLMHDNN5OKPEDVN4KXZANCNFSM5X3GWEPA . You are receiving this because you commented.Message ID: @.***>
I am trying out Imageflow on an episerver 12 site (local development so far) but have some issues with the Imageflow querystring API not triggering
I have the following packages installed:
I have the following in Startup.Configure:
<img src="https://localhost:5000/globalassets/1406-onebody_slide.jpg?width=100" alt="" />
https://localhost:5000/globalassets/1406-onebody_slide.jpg?width=100
https://localhost:5000/test-image
url, the the resize doesn't triggerhttps://localhost:5000/test.jpg?width=450
the resizing does triggerAdditionally, the
.AddCommandDefault()
s are not applied in any of the test cases.What am I doing wrong?