本文整理汇总了C#中Photo.GetOriginalFileURL方法的典型用法代码示例。如果您正苦于以下问题:C# Photo.GetOriginalFileURL方法的具体用法?C# Photo.GetOriginalFileURL怎么用?C# Photo.GetOriginalFileURL使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Photo
的用法示例。
在下文中一共展示了Photo.GetOriginalFileURL方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Upload
public static Photo Upload(BaseController controller, UploadPOSTParameters param)
{
var photo = new Photo();
controller.DatabaseSession.Save(photo);
controller.DatabaseSession.Flush(); // to get the ID
var unique_id = photo.PhotoId.ToString();
var original_buffer = new byte[param.Photo.ContentLength];
param.Photo.InputStream.Read(original_buffer, 0, param.Photo.ContentLength);
using (var originalBitmap = ImageUtilities.LoadBitmap(original_buffer))
{
AzureBlogStorageUtil.PutBlob(photo.GetOriginalFileURL()
, azureStorageAccountName, azureStorageAccountKey
, ImageUtilities.GetBytes(originalBitmap, ImageFormat.Jpeg), "image/jpeg");
if (originalBitmap.Width > 600 || originalBitmap.Height > 800)
{
// original image is too large for general display
photo.LargeFileIsSameAsOriginal = false;
using (var largeBitmap = ImageUtilities.Resize(originalBitmap, 600, 800))
{
AzureBlogStorageUtil.PutBlob(photo.GetLargeFileURL()
, azureStorageAccountName, azureStorageAccountKey
, ImageUtilities.GetBytes(largeBitmap, ImageFormat.Jpeg), "image/jpeg");
}
}
using (var thumbnailBitmap = ImageUtilities.Resize(originalBitmap, 240, 240))
{
AzureBlogStorageUtil.PutBlob(photo.GetThumbnailFileURL()
, azureStorageAccountName, azureStorageAccountKey
, ImageUtilities.GetBytes(thumbnailBitmap, ImageFormat.Jpeg), "image/jpeg");
}
using (var tinyBitmap = ImageUtilities.Resize(originalBitmap, 50, 50))
{
AzureBlogStorageUtil.PutBlob(photo.GetTinyFileURL()
, azureStorageAccountName, azureStorageAccountKey
, ImageUtilities.GetBytes(tinyBitmap, ImageFormat.Jpeg), "image/jpeg");
}
}
return photo;
}