mirror of
http://git.coreshop.cn/jianweie/coreshoppro.git
synced 2025-12-06 19:03:27 +08:00
优化无小程序用户二维码的情况下,保证海报生成不出错。
This commit is contained in:
@@ -855,7 +855,10 @@ namespace CoreCms.Net.Services
|
||||
|
||||
//文件硬地址
|
||||
var savePath = _webHostEnvironment.WebRootPath + "/static/poster/";
|
||||
//用户二维码头像
|
||||
var qrCodeDir = _webHostEnvironment.WebRootPath + "/static/qrCode/weChat/" + otherData;
|
||||
|
||||
|
||||
//如果文件夹不存在,则创建文件夹
|
||||
if (!Directory.Exists(savePath)) Directory.CreateDirectory(savePath);
|
||||
|
||||
@@ -901,15 +904,22 @@ namespace CoreCms.Net.Services
|
||||
});
|
||||
//将商品大图合并到背景图上
|
||||
imageTemple.Mutate(x => x.DrawImage(imageThumbnail, new SixLabors.ImageSharp.Point(0, 0), 1));
|
||||
//将用户的分享二维码合并大背景图上
|
||||
var imageQrcode = await SixLabors.ImageSharp.Image.LoadAsync(qrCodeDir);
|
||||
//将二维码缩略至120X120
|
||||
imageQrcode.Mutate(x =>
|
||||
|
||||
//如果已经存在用户头像的情况下。则附加渲染二维码
|
||||
//QrCode 根目录
|
||||
if (File.Exists(qrCodeDir))
|
||||
{
|
||||
x.Resize(120, 120);
|
||||
});
|
||||
//将二维码图片合并到背景图上
|
||||
imageTemple.Mutate(x => x.DrawImage(imageQrcode, new SixLabors.ImageSharp.Point(275, 420), 1));
|
||||
//将用户的分享二维码合并大背景图上
|
||||
var imageQrcode = await SixLabors.ImageSharp.Image.LoadAsync(qrCodeDir);
|
||||
//将二维码缩略至120X120
|
||||
imageQrcode.Mutate(x =>
|
||||
{
|
||||
x.Resize(120, 120);
|
||||
});
|
||||
//将二维码图片合并到背景图上
|
||||
imageTemple.Mutate(x => x.DrawImage(imageQrcode, new SixLabors.ImageSharp.Point(275, 420), 1));
|
||||
}
|
||||
|
||||
//构建字体//装载字体(ttf)(而且字体一定要支持简体中文的)
|
||||
var fonts = new FontCollection();
|
||||
SixLabors.Fonts.FontFamily fontFamily = fonts.Install(_webHostEnvironment.WebRootPath + "/fonts/SourceHanSansK-Normal.ttf");
|
||||
@@ -982,15 +992,22 @@ namespace CoreCms.Net.Services
|
||||
});
|
||||
//将商品大图合并到背景图上
|
||||
imageTemple.Mutate(x => x.DrawImage(imageThumbnail, new SixLabors.ImageSharp.Point(0, 0), 1));
|
||||
//将用户的分享二维码合并大背景图上
|
||||
var imageQrcode = await SixLabors.ImageSharp.Image.LoadAsync(qrCodeDir);
|
||||
//将二维码缩略至120X120
|
||||
imageQrcode.Mutate(x =>
|
||||
|
||||
//如果已经存在用户头像的情况下。则附加渲染二维码
|
||||
//QrCode 根目录
|
||||
if (File.Exists(qrCodeDir))
|
||||
{
|
||||
x.Resize(120, 120);
|
||||
});
|
||||
//将二维码图片合并到背景图上
|
||||
imageTemple.Mutate(x => x.DrawImage(imageQrcode, new SixLabors.ImageSharp.Point(275, 420), 1));
|
||||
//将用户的分享二维码合并大背景图上
|
||||
var imageQrcode = await SixLabors.ImageSharp.Image.LoadAsync(qrCodeDir);
|
||||
//将二维码缩略至120X120
|
||||
imageQrcode.Mutate(x =>
|
||||
{
|
||||
x.Resize(120, 120);
|
||||
});
|
||||
//将二维码图片合并到背景图上
|
||||
imageTemple.Mutate(x => x.DrawImage(imageQrcode, new SixLabors.ImageSharp.Point(275, 420), 1));
|
||||
}
|
||||
|
||||
//构建字体//装载字体(ttf)(而且字体一定要支持简体中文的)
|
||||
var fonts = new FontCollection();
|
||||
SixLabors.Fonts.FontFamily fontFamily = fonts.Install(_webHostEnvironment.WebRootPath + "/fonts/SourceHanSansK-Normal.ttf");
|
||||
|
||||
Reference in New Issue
Block a user