dotnetnuke - 2SXC Image Format Not Updating - Stack Overflow

Problem:I'm using the @Kit.Image.Picture() method to render an image with specific settings. My g

Problem:

I'm using the @Kit.Image.Picture() method to render an image with specific settings. My goal is to force the image to be in the WebP format. Here’s the code snippet I’m using:

@Kit.Image.Picture(image, width: "390", settings: "NewsList", imgAlt: altText)

When selecting an image format (e.g., WebP or PNG) via the Two Signals interface, the Format property in IResizeSettings is not updated. This results in the generated URL not including the ?format= parameter, and the image is served in its default format.

Settings Framework Details:

I'm relying on the Settings method for constructing resize settings. The following format-related parameters are documented and available:

IResizeSettings Settings(object settings = null, NoParamOrder noParamOrder = default, Func<ITweakResize, ITweakResize> tweak = null, object factor = null, object width = null, object height = null, object quality = null, string resizeMode = null, string scaleMode = null, string format = null, object aspectRatio = null, string parameters = null, object recipe = null)

In the documentation, the format parameter should allow me to specify a target format (e.g., webp or png <string>). However, when I specify WebP, the resulting image does not update to the WebP format.

Expected Outcome:

The generated image URLs should include the .webp extension, indicating that the images are served in the WebP format.

Actual Outcome:

The image URLs remain unchanged, and the images are not served in the WebP format as intended.

Setting in 2SXC App Setting
ImageResizer URL unchanged

Problem:

I'm using the @Kit.Image.Picture() method to render an image with specific settings. My goal is to force the image to be in the WebP format. Here’s the code snippet I’m using:

@Kit.Image.Picture(image, width: "390", settings: "NewsList", imgAlt: altText)

When selecting an image format (e.g., WebP or PNG) via the Two Signals interface, the Format property in IResizeSettings is not updated. This results in the generated URL not including the ?format= parameter, and the image is served in its default format.

Settings Framework Details:

I'm relying on the Settings method for constructing resize settings. The following format-related parameters are documented and available:

IResizeSettings Settings(object settings = null, NoParamOrder noParamOrder = default, Func<ITweakResize, ITweakResize> tweak = null, object factor = null, object width = null, object height = null, object quality = null, string resizeMode = null, string scaleMode = null, string format = null, object aspectRatio = null, string parameters = null, object recipe = null)

In the documentation, the format parameter should allow me to specify a target format (e.g., webp or png <string>). However, when I specify WebP, the resulting image does not update to the WebP format.

Expected Outcome:

The generated image URLs should include the .webp extension, indicating that the images are served in the WebP format.

Actual Outcome:

The image URLs remain unchanged, and the images are not served in the WebP format as intended.

Setting in 2SXC App Setting
ImageResizer URL unchanged

Share Improve this question asked Jan 29 at 12:13 RudhycodesRudhycodes 11 silver badge
Add a comment  | 

2 Answers 2

Reset to default 1

When I do something like:

 var customSettingsMax = AsDynamic(new {
    Width = 350,
    ResizeMode = "Max",
    format= "webp",
    quality= 100
  });

<img loading="lazy" src='@Link.Image(imgUrl, customSettingsMax)'>

It wil not generate a webp. However, when I do:

<img loading="lazy" src='@Link.Image(imgUrl, customSettingsMax, format: "webp")'>

It will, so I think the format setting is ignored somewhere....

(note: I accidentally wrote an answer to an other issue here first)

My understanding is what you are doing should work.

My guess is you made a mistake - such as changing the configuration for NewsList images (as in the screenshot), but not using that name in your Razor code, in which case the settings for Default are used.

So I would check that first.

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745298947a4621316.html

相关推荐

  • dotnetnuke - 2SXC Image Format Not Updating - Stack Overflow

    Problem:I'm using the @Kit.Image.Picture() method to render an image with specific settings. My g

    8小时前
    40

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信