The Daily WTF: Curious Perversions in Information Technology
Welcome to TDWTF Forums Sign in | Join | Help
in Search

confession.toString()

Last post 03-07-2013 4:44 AM by MiffTheFox. 1 replies.
Page 1 of 1 (2 items)
Sort Posts: Previous Next
  • 03-06-2013 12:59 AM

    • azpad1
    • Not Ranked
    • Joined on 03-06-2013
    • Posts 1

    confession.toString()

     Tiny bit of background:

    • Making WP8 app
    • No clue how to use azure
    • Never worked with images in code
    • 3-4 hours of time left
    • Primary function of app: store images in Azure

    Code snippet says the rest :)

     

    async void uploadToAzure(BitmapImage bmp, String a, String b,String c)
            {
                System.Windows.Media.Imaging.WriteableBitmap wbmp = new System.Windows.Media.Imaging.WriteableBitmap(bmp);
                wbmp = wbmp.Resize(200, 200, WriteableBitmapExtensions.Interpolation.Bilinear);
                byte[ _imageBytes = wbmp.ToByteArray();
                String s = Convert.ToBase64String(_imageBytes, 0, _imageBytes.Length);
                ittab item = new ittab {Image=s,A=a,B=b,C=c,f=1};
                await App.MobileService.GetTable<ittab>().InsertAsync(item);
            }

     

    To get the stuff back,

     await App.MobileService.GetTable<ittab>().ToListAsync() (or something of the sort) , then iterate through the list ...

     

  • 03-07-2013 4:44 AM In reply to

    Re: confession.toString()

    I see the WTF. You should be writing out the image to a MemoryStream in PNG format instead of using a WritableBitmap.

    Information technology not available until further notice. The political trolls won. Wake me up when the discussion is more interesting then YouTube comments.

Page 1 of 1 (2 items)
Powered by Community Server (Non-Commercial Edition), by Telligent Systems