68 lines
1.5 KiB
C#
68 lines
1.5 KiB
C#
using Newtonsoft.Json;
|
|
using Store.Management.Framework.Helpers;
|
|
using System.Drawing;
|
|
|
|
namespace Store.Product.Models.Product.Image
|
|
{
|
|
/// <summary>
|
|
/// 商品图片
|
|
/// </summary>
|
|
public class ProductImage
|
|
{
|
|
|
|
public ProductImage()
|
|
{
|
|
|
|
}
|
|
public ProductImage(string url)
|
|
{
|
|
ImgUrl = url;
|
|
}
|
|
//public ProductImage(string url, ImageType type)
|
|
//{
|
|
// ImgUrl = url;
|
|
// ImageType = type;
|
|
//}
|
|
/// <summary>
|
|
/// 图片类型
|
|
/// </summary>
|
|
public virtual ProductImageType ImageType { get; protected set; } = ProductImageType.None;
|
|
/// <summary>
|
|
/// 文件名
|
|
/// </summary>
|
|
public string FileName { get; set; }
|
|
/// <summary>
|
|
/// 图片源路径
|
|
/// </summary>
|
|
public string ImgUrl { get; set; }
|
|
|
|
private byte[] _imgbyte;
|
|
/// <summary>
|
|
/// 图片流
|
|
/// </summary>
|
|
[JsonIgnore]
|
|
public byte[] ImgByte
|
|
{
|
|
get
|
|
{
|
|
if (_imgbyte == null)
|
|
{
|
|
_imgbyte = ImageHelper.DownloadImage(ImgUrl);
|
|
}
|
|
return _imgbyte;
|
|
}
|
|
set
|
|
{
|
|
_imgbyte = value;
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// 上传后图片路径
|
|
/// </summary>
|
|
public string UploadImgUrl { get; set; }
|
|
|
|
|
|
|
|
}
|
|
}
|