🎨 Improve image export size for database assets fields https://github.com/siyuan-note/siyuan/issues/16470

Signed-off-by: Daniel <845765@qq.com>
This commit is contained in:
Daniel 2026-01-17 10:45:04 +08:00
parent 6ee0b663e2
commit 3e6e5fa3a4
No known key found for this signature in database
GPG key ID: 86211BA83DF03017
2 changed files with 26 additions and 4 deletions

View file

@ -51,6 +51,24 @@ import (
"github.com/siyuan-note/siyuan/kernel/util"
)
func GetAssetImgSize(assetPath string) (width, height int) {
absPath, err := GetAssetAbsPath(assetPath)
if err != nil {
logging.LogErrorf("get asset [%s] abs path failed: %s", assetPath, err)
return
}
img, err := imaging.Open(absPath)
if err != nil {
logging.LogErrorf("open asset image [%s] failed: %s", absPath, err)
return
}
width = img.Bounds().Dx()
height = img.Bounds().Dy()
return
}
func GetAssetPathByHash(hash string) string {
assetHash := cache.GetAssetHash(hash)
if nil == assetHash {