我也遇到过你所的问题,是tools\verifyimagepage.aspx找不到georgia,分析DISCUZ.PlugIn.dll后发现生成随机码的函数是随机读取字体数组,它的代码如下
public VerifyImageInfo GenerateImage(string code, int width, int height, Color bgcolor, int textcolor)
{
VerifyImageInfo info = new VerifyImageInfo();
info.ImageFormat = ImageFormat.Jpeg;
info.C;
width = 120;
height = 40;
Bitmap image = new Bitmap(width, height, PixelFormat.Format32bppArgb);
Graphics graphics = Graphics.FromImage(image);
graphics.SmoothingMode = SmoothingMode.HighSpeed;
graphics.Clear(bgcolor);
int num = (textcolor == 2) ? 60 : 0;
Pen pen = new Pen(Color.FromArgb(Next(50) + num, Next(50) + num, Next(50) + num), 1f);
SolidBrush brush = new SolidBrush(Color.FromArgb(Next(100), Next(100), Next(100)));
for (int i = 0; i < 3; i++)
{
graphics.DrawArc(pen, Next(20) - 10, Next(20) - 10, Next(width) + 10, Next(height) + 10, Next(-100, 100), Next(-200, 200));
}
Graphics graphics2 = Graphics.FromImage(charbmp);
float x = -18f;
for (int j = 0; j < code.Length; j++)
{
m.Reset();
m.RotateAt((float) (Next(50) - 0x19), new PointF((float) (Next(3) + 7), (float) (Next(3) + 7)));
graphics2.Clear(Color.Transparent);
graphics2.Transform = m;
brush.Color = Color.Black;
x = (x + 18f) + Next(5);
PointF point = new PointF(x, 2f);
///下面这句是随机读取字体数组,希望下个版本把生成随机码的字体能改进一下,不然后台都进不了。
graphics2.DrawString(code[j].ToString(),
fonts[Next(fonts.Length - 1)], brush, new PointF(0f, 0f));
graphics2.ResetTransform();
graphics.DrawImage(charbmp, point);
}
brush.Dispose();
graphics.Dispose();
graphics2.Dispose();
info.Image = image;
return info;
}
Discuz.Plugin.VerifyImage.JpegImage{ public class VerifyImage : IVerifyImage
}VerifyImage类的静态构造函数如下:
static VerifyImage()
{
randb = new byte[4];
rand = new RNGCryptoServiceProvider();
m = new Matrix();
charbmp = new Bitmap(40, 40);
fonts = new Font[] { new Font(new FontFamily("Times New Roman"), (float) (0x10 + Next(3)), FontStyle.Regular), new Font(new FontFamily("Georgia"), (float) (0x10 + Next(3)), FontStyle.Regular), new Font(new FontFamily("Arial"), (float) (0x10 + Next(3)), FontStyle.Regular), new Font(new FontFamily("Comic Sans MS"), (float) (0x10 + Next(3)), FontStyle.Regular) };
}