Adds small exif library to read meta data from jpg's so we can attempt to read width/height from exif instead of loading the file into mem with GDI, makes for much faster and far less memory processing.U4-6246 Uploading specific images causes GDI+ Errors

This commit is contained in:
Shannon
2015-02-10 16:33:59 +11:00
parent dd680b6fd1
commit 0efb9b72e7
9 changed files with 1076 additions and 11 deletions

View File

@@ -482,17 +482,27 @@ namespace Umbraco.Core
/// <returns></returns>
public static string ConvertToHex(this string input)
{
if (String.IsNullOrEmpty(input)) return String.Empty;
if (string.IsNullOrEmpty(input)) return string.Empty;
var sb = new StringBuilder(input.Length);
foreach (char c in input)
foreach (var c in input)
{
int tmp = c;
sb.AppendFormat("{0:x2}", Convert.ToUInt32(c));
}
return sb.ToString();
}
public static string DecodeFromHex(this string hexValue)
{
var strValue = "";
while (hexValue.Length > 0)
{
strValue += Convert.ToChar(Convert.ToUInt32(hexValue.Substring(0, 2), 16)).ToString();
hexValue = hexValue.Substring(2, hexValue.Length - 2);
}
return strValue;
}
///<summary>
/// Encodes a string to a safe URL base64 string
///</summary>