优化微信图片不能显示的问题

This commit is contained in:
wule committed 2026-08-24 20:38:22 +08:00
1 parent 9e71c54414
commit 57e9190241
9 files changed
+126 -56

No files matched your search

@@ -11,6 +11,7 @@ using System.Data;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Security.Cryptography;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
@@ -73,7 +74,9 @@ namespace TemuKJD.PDDForms.ProductSelectForms
// 加载主图和详情图
foreach (var image in prodInfo.detail.galleries)
{
var imgUrl = image.url.ParseToString().Replace("https", "http") + "?" + Randomx.GetId(10000000, 99999999);
var imgUrl = image.url.ParseToString() + "?" + Randomx.GetId(10000000, 99999999);
if (!imgUrl.Contains("wxapp"))
imgUrl = imgUrl.Replace("https", "http");
imgDic[imgUrl] = imgUrl;
var pb = new PictureBox()
{
@@ -83,6 +86,12 @@ namespace TemuKJD.PDDForms.ProductSelectForms
ImageLocation = imgUrl,
BorderStyle = BorderStyle.FixedSingle,
};
if (imgUrl.Contains("wxapp"))
{
pb.ImageLocation = null;
string getImgError = "";
pb.Image = ImageBuild.LoadBitmapLoadBitmipImageFromUrl(imgUrl.Replace("http://", "https://"), out getImgError);
}
pb.Click += Pb_Click;
if (image.type == 1)
@@ -125,7 +134,7 @@ namespace TemuKJD.PDDForms.ProductSelectForms
if (pb == null)
return;
ShowImgForm imgFrom = new ShowImgForm(pb.ImageLocation, imgDic);
ShowImgForm imgFrom = new ShowImgForm(pb.ImageLocation == null ? pb.Tag.ParseToString() : pb.ImageLocation, imgDic);
imgFrom.ShowDialog();
}
@@ -2,6 +2,7 @@
using AllBase.Helper;
using AllBase.Model.Result;
using AllBase.Model.Result.PDDResult;
using NaiBa.Util.Extension;
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
@@ -39,7 +40,14 @@ namespace TemuKJD.PDDForms.ProductSelectForms
txtProductName.Text = dbProd.product_name;
txtSkcId.Text = dbProd.skc_id;
txtSpuId.Text = dbProd.spu_id;
this.pictureBox1.ImageLocation = dbProd.main_img.Replace("https", "http");
pictureBox1.Tag = dbProd.main_img;
if (dbProd.main_img.Contains("wxapp"))
{
string getImgError = "";
this.pictureBox1.Image = ImageBuild.LoadBitmapLoadBitmipImageFromUrl(dbProd.main_img, out getImgError);
}
else
this.pictureBox1.ImageLocation = dbProd.main_img.Replace("https", "http");
this.txtNotes.Text = dbProd.notes;
this.txtExtCode.Text = dbProd.ext_code;
this.txtFissionWords.Text = dbProd.fission_words.Replace("fission_goods_names:", "");
@@ -105,7 +113,7 @@ namespace TemuKJD.PDDForms.ProductSelectForms
private void pictureBox1_Click(object sender, EventArgs e)
{
ShowImgForm imgFrom = new ShowImgForm(pictureBox1.ImageLocation);
ShowImgForm imgFrom = new ShowImgForm(pictureBox1.ImageLocation == null ? pictureBox1.Tag.ParseToString() : pictureBox1.ImageLocation);
imgFrom.ShowDialog();
}