|
|
|
@ -3367,30 +3367,6 @@ namespace UMC.Proxy
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
public static bool TryImageConfig(string rook, string confKey, out WebMeta confValue)
|
|
|
|
|
{
|
|
|
|
|
confValue = null;
|
|
|
|
|
if (String.IsNullOrEmpty(confKey) == false)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
if (NetClient.TryImageConf(confKey, out confValue))
|
|
|
|
|
{
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
var mainKey = String.Format("SITE_IMAGE_CONFIG_{0}{1}", rook, MD5(confKey, "")).ToUpper();
|
|
|
|
|
var config = UMC.Data.DataFactory.Instance().Config(mainKey);
|
|
|
|
|
if (config != null)
|
|
|
|
|
{
|
|
|
|
|
confValue = UMC.Data.JSON.Deserialize<WebMeta>(config.ConfValue);
|
|
|
|
|
if (confValue != null)
|
|
|
|
|
{
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
public void ProcessRequest()
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
@ -4639,5 +4615,128 @@ namespace UMC.Proxy
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
public static bool TryImageConf(string confKey, out WebMeta confValue)
|
|
|
|
|
{
|
|
|
|
|
confValue = null;
|
|
|
|
|
if (String.IsNullOrEmpty(confKey) == false)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
var match = System.Text.RegularExpressions.Regex.Match(confKey, "^[h|w|c|t|m|b](\\d+)([-|x]\\d+)?([g|p|j|w|a|o]?)$");
|
|
|
|
|
|
|
|
|
|
if (match.Success)
|
|
|
|
|
{
|
|
|
|
|
confValue = new WebMeta();
|
|
|
|
|
switch (match.Groups[3].Value)
|
|
|
|
|
{
|
|
|
|
|
case "g":
|
|
|
|
|
confValue.Put("Format", "gif");
|
|
|
|
|
break;
|
|
|
|
|
case "j":
|
|
|
|
|
confValue.Put("Format", "jpeg");
|
|
|
|
|
break;
|
|
|
|
|
case "w":
|
|
|
|
|
confValue.Put("Format", "webp");
|
|
|
|
|
break;
|
|
|
|
|
case "p":
|
|
|
|
|
confValue.Put("Format", "png");
|
|
|
|
|
break;
|
|
|
|
|
case "a":
|
|
|
|
|
confValue.Put("Format", "avif");
|
|
|
|
|
break;
|
|
|
|
|
case "o":
|
|
|
|
|
confValue.Put("Format", "Optimal");
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
confValue.Put("Width", match.Groups[1].Value);
|
|
|
|
|
if (match.Groups[2].Length > 0)
|
|
|
|
|
{
|
|
|
|
|
switch (match.Groups[0].Value[0])
|
|
|
|
|
{
|
|
|
|
|
case '-':
|
|
|
|
|
confValue.Put("Width", "-" + match.Groups[1].Value);
|
|
|
|
|
confValue.Put("Height", "-" + match.Groups[0].Value);
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
confValue.Put("Height", match.Groups[2].Value.Substring(1));
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
confValue.Put("Height", match.Groups[1].Value);
|
|
|
|
|
}
|
|
|
|
|
switch (confKey[0])
|
|
|
|
|
{
|
|
|
|
|
case 'w':
|
|
|
|
|
confValue.Remove("Height");
|
|
|
|
|
break;
|
|
|
|
|
case 'h':
|
|
|
|
|
confValue.Remove("Width");
|
|
|
|
|
break;
|
|
|
|
|
case 'c':
|
|
|
|
|
confValue["Model"] = "0";
|
|
|
|
|
break;
|
|
|
|
|
case 't':
|
|
|
|
|
confValue["Model"] = "1";
|
|
|
|
|
break;
|
|
|
|
|
case 'm':
|
|
|
|
|
confValue["Model"] = "2";
|
|
|
|
|
break;
|
|
|
|
|
case 'b':
|
|
|
|
|
confValue["Model"] = "3";
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
switch (confKey)
|
|
|
|
|
{
|
|
|
|
|
case "g":
|
|
|
|
|
confValue = new WebMeta().Put("Format", "gif");
|
|
|
|
|
return true;
|
|
|
|
|
case "j":
|
|
|
|
|
confValue = new WebMeta().Put("Format", "jpeg");
|
|
|
|
|
return true;
|
|
|
|
|
case "w":
|
|
|
|
|
confValue = new WebMeta().Put("Format", "webp");
|
|
|
|
|
return true;
|
|
|
|
|
case "p":
|
|
|
|
|
confValue = new WebMeta().Put("Format", "png");
|
|
|
|
|
return true;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static bool TryImageConfig(string rook, string confKey, out WebMeta confValue)
|
|
|
|
|
{
|
|
|
|
|
confValue = null;
|
|
|
|
|
if (String.IsNullOrEmpty(confKey) == false)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
if (TryImageConf(confKey, out confValue))
|
|
|
|
|
{
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
var mainKey = String.Format("SITE_IMAGE_CONFIG_{0}{1}", rook, MD5(confKey, "")).ToUpper();
|
|
|
|
|
var config = UMC.Data.DataFactory.Instance().Config(mainKey);
|
|
|
|
|
if (config != null)
|
|
|
|
|
{
|
|
|
|
|
confValue = UMC.Data.JSON.Deserialize<WebMeta>(config.ConfValue);
|
|
|
|
|
if (confValue != null)
|
|
|
|
|
{
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|