.net core 部署在centos7,验证码不显示

.net core 部署在centos7,验证码不显示,报如下错误:

 The type initializer for 'Gdip' threw an exception.
 ---> System.DllNotFoundException: Unable to load shared library 'libgdiplus' or one of its dependencies. In order to help diagnose loading problems, consider setting the LD_DEBUG environment variable: liblibgdiplus: cannot o
pen shared object file: No such file or directory

参照:https://github.com/dotnet/core/issues/2746

sudo yum install libc6-dev 
sudo yum install libgdiplus

 继续解决下一个问题

正常验证码如下

 部署到centos 7,变形了,字体的位置好像不对路啊,什么鸟问题??

字体用的是资源包里的,

pfc.AddMemoryFont(ResourcesHelper.GetResFontPtr(Properties.Resources.elephant), Properties.Resources.elephant.Length);
pfc.AddMemoryFont(ResourcesHelper.GetResFontPtr(Properties.Resources.georgia), Properties.Resources.georgia.Length);
pfc.AddMemoryFont(ResourcesHelper.GetResFontPtr(Properties.Resources.Vineta), Properties.Resources.Vineta.Length);

待解决...........

 临时解决方案,字体复制到

/usr/share/fonts/micro/

原文地址:https://www.cnblogs.com/icejd/p/14600938.html