DioxusLabs/dioxus

Auto width/height for manganis images

开放

#5,458 创建于 2026年4月7日

 (0 条评论) (0 个反应) (0 位负责人)Rust (1,655 个派生)batch import
enhancementgood first issuemanganis

仓库指标

星标
 (36,038 个星标)
PR 合并指标
 (平均合并 16天 13小时) (30 天内合并 9 个 PR)

描述

Feature Request

You can currently not set the image size for images or set both the width and height. You should be able to set either the width or height and have the other derived from the aspect ratio of the image

Implement Suggestion

Allow with_width or with_height and derive the other dimension

// Resize the image at compile time to make the assets smaller
pub const RESIZED_PNG_ASSET: Asset =
    asset!("/assets/image.png", AssetOptions::image().with_width(52));

or

// Resize the image at compile time to make the assets smaller
pub const RESIZED_PNG_ASSET: Asset =
    asset!("/assets/image.png", AssetOptions::image().with_height(52));

贡献者指南