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));

貢獻者指南