docker 或linux 中使用 图片类
docker 或linux 中使用 图片类
异常报错
The type initializer for 'Gdip' threw an exception. Unable to load shared library 'libdl' or one of its dependencies. In order to help diagnose loading problems, consider setting the LD_DEBUG environment variable: liblibdl: cannot open shared object file: No such file or directory
一. 引用ZKWeb.System.Drawing
Install-Package ZKWeb.System.Drawing
二. 页面上引用using System.DrawingCore
将原来的
using System.Drawing;
using System.Drawing.Imaging;
改为ZKWeb的
using System.DrawingCore;
using System.DrawingCore.Imaging;
三. 修改DockerFile
- 加入安装命令
RUN apt-get update -y && apt-get install -y libgdiplus && apt-get clean && ln -s /usr/lib/libgdiplus.so /usr/lib/gdiplus.dll
- 或直接用 stulzq/dotnet:2.2.0-aspnetcore-runtime-with-image 做为底包
将
FROM mcr.microsoft.com/dotnet/core/aspnet:2.2-stretch-slim AS base
改为
FROM stulzq/dotnet:2.2.0-aspnetcore-runtime-with-image AS base
源码地址:https://github.com/langfengac/Demo/tree/master/ImagesIssue
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】凌霞软件回馈社区,博客园 & 1Panel & Halo 联合会员上线
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】博客园社区专享云产品让利特惠,阿里云新客6.5折上折
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步