Fixed issue with attachment tokens. Changed how attachments are handled to be more modular. Added support for PNG files.
This commit is contained in:
@@ -12,6 +12,8 @@ namespace PWAPPv2.Source.DataObjects
|
||||
|
||||
private BitmapImage bitmap;
|
||||
|
||||
public string FileType { get; }
|
||||
|
||||
|
||||
//private Bitmap bmp;
|
||||
//private Bitmap thumb;
|
||||
@@ -26,6 +28,17 @@ namespace PWAPPv2.Source.DataObjects
|
||||
bitmap.DecodePixelWidth = 100;
|
||||
bitmap.EndInit();
|
||||
|
||||
string extension = Path.GetExtension(path).ToLower();
|
||||
|
||||
if(extension == ".jpeg" || extension == ".jpg")
|
||||
{
|
||||
FileType = "image/jpeg";
|
||||
}
|
||||
else if(extension == ".png")
|
||||
{
|
||||
FileType = "image/png";
|
||||
}
|
||||
|
||||
//bmp = (Bitmap)System.Drawing.Image.FromFile(ImagePath);
|
||||
//thumb = resize(bmp, 50, 50);
|
||||
//zoom = resize(bmp, bmp.Width, bmp.Height);
|
||||
@@ -96,5 +109,14 @@ namespace PWAPPv2.Source.DataObjects
|
||||
return ImagePath.Substring(ImagePath.LastIndexOf("\\") + 1);
|
||||
}
|
||||
|
||||
public string GetJsonContents()
|
||||
{
|
||||
string str = "'Base64FileContents':'" + GetBase64String() + "',\n" +
|
||||
"'Base64ThumbContents':'" + GetBase64ThumbString() + "',\n" +
|
||||
"'Base64ZoomContents':'" + GetBase64ZoomString() + "'\n";
|
||||
|
||||
return str;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user