×

Discussion Board

Page 1 of 2 12 LastLast
Results 1 to 15 of 18
  1. #1
    Registered User
    Join Date
    Dec 2005
    Posts
    63

    Opening image for viewing and sharing

    How to open a specific image (filename known) for viewing and sharing ? Without selecting it from a list.

  2. #2
    Nokia Developer Champion
    Join Date
    Mar 2013
    Posts
    510

    Re: Opening image for viewing and sharing

    Is the file saved to IsolatedStorage or is it deployed along with the application. Or are you talking about an image on the Web?

    What control do you want to display the image in?

  3. #3
    Registered User
    Join Date
    Dec 2005
    Posts
    63

    Re: Opening image for viewing and sharing

    It is saved in phone medialibrary. Control could be the os default viewer. (Photos - albums - saved pictures ...)

  4. #4
    Nokia Developer Champion
    Join Date
    Nov 2011
    Location
    la bouexiere, france
    Posts
    470

    Re: Opening image for viewing and sharing

    Can you explain what do you want do exactly?

  5. #5
    Nokia Developer Champion
    Join Date
    Mar 2013
    Posts
    510

    Re: Opening image for viewing and sharing

    ShareMediaTask will allow you to select an option for sharing an Image from the MediaLibrary (it doesn't work unless it is stored there) but as far as I can remember it doesn't display the Image while doing so.

    PS: For whatever reason my post appears before the post of pkarpion that I replied to... guess the server time changed in the meantime...

  6. #6
    Registered User
    Join Date
    Dec 2005
    Posts
    63

    Re: Opening image for viewing and sharing

    I think I try to use sharemediatask.

  7. #7
    Registered User
    Join Date
    Dec 2005
    Posts
    63

    Re: Opening image for viewing and sharing

    Yes, this seems to be a problem, that I can't know when the image is saved and ready. I'm trying to share captured screen.

    Quote Originally Posted by SB Dev View Post
    ShareMediaTask will allow you to select an option for sharing an Image from the MediaLibrary (it doesn't work unless it is stored there) but as far as I can remember it doesn't display the Image while doing so.

    PS: For whatever reason my post appears before the post of pkarpion that I replied to... guess the server time changed in the meantime...

  8. #8
    Nokia Developer Champion
    Join Date
    Mar 2013
    Posts
    510

    Re: Opening image for viewing and sharing

    If it is about sharing a capture from another App then you will not have a possibility to detect the correct image and also won't be able to run your sharing automatically. If it is about capturing a screenshot of your own App and then sharing it, you might want to look into this article: http://developer.nokia.com/Community...indows_Phone_7

    It works the same on WP8 and will allow you to render your App's UI into a WritableBitmap which you can then save/share.

  9. #9
    Registered User
    Join Date
    Dec 2005
    Posts
    63

    Re: Opening image for viewing and sharing

    I can save the screen capture. Problem is that I can't share it after that with sharemediatask. I should probably wait or syncronize something somehow. Filepath is ok, because I can share previous images.

    ShareMediaTask shareMediaTask = new ShareMediaTask();
    shareMediaTask.FilePath = "C:\\Data\\Users\\Public\\Pictures\\Saved Pictures\\" + currentFileName;
    shareMediaTask.Show();

  10. #10
    Nokia Developer Champion
    Join Date
    Mar 2013
    Posts
    510

    Re: Opening image for viewing and sharing

    So how are you saving the screenshot? Perhaps you're using an async method without awaiting it?

  11. #11
    Registered User
    Join Date
    Dec 2005
    Posts
    63

    Re: Opening image for viewing and sharing

    As far as I understand I'm not using async. I use Medialibrary SavePicture method from some example. When program is running I can check with 'Photos' that the image is there. My program just isn't able to see it.

  12. #12
    Nokia Developer Champion
    Join Date
    Nov 2011
    Location
    la bouexiere, france
    Posts
    470

    Re: Opening image for viewing and sharing

    SavePicture return a Picture.
    You must add
    Code:
    using Microsoft.Xna.Framework.Media.PhoneExtensions;
    which extend Picture class with GetPath() function.
    Last edited by yan_; 2013-09-09 at 08:31.

  13. #13
    Registered User
    Join Date
    Dec 2005
    Posts
    63

    Re: Opening image for viewing and sharing

    Thanks! Something with the path was wrong.

  14. #14
    Registered User
    Join Date
    Sep 2013
    Posts
    1

    Re: Opening image for viewing and sharing

    Great
    private void ApplicationBarIconButton_Click(object sender, EventArgs e)
    {
    var fileName = String.Format("WmDev_{0:}.jpg", DateTime.Now.Ticks);
    WriteableBitmap bmpCurrentScreenImage = new WriteableBitmap((int)this.ActualWidth, (int)this.ActualHeight);
    bmpCurrentScreenImage.Render(LayoutRoot, new MatrixTransform());
    bmpCurrentScreenImage.Invalidate();
    SaveToMediaLibrary(bmpCurrentScreenImage, fileName, 100);
    MessageBox.Show("Captured image " + fileName + " Saved Sucessfully", "WmDev Capture Screen", MessageBoxButton.OK);

    currentFileName = fileName;
    }

    public void SaveToMediaLibrary(WriteableBitmap bitmap, string name, int quality)
    {
    using (var stream = new MemoryStream())
    {
    // Save the picture to the Windows Phone media library.
    bitmap.SaveJpeg(stream, bitmap.PixelWidth, bitmap.PixelHeight, 0, quality);
    stream.Seek(0, SeekOrigin.Begin);
    new MediaLibrary().SavePicture(name, stream);
    }
    }

  15. #15
    Registered User
    Join Date
    Sep 2013
    Posts
    1

    Re: Opening image for viewing and sharing

    What's mean?
    stream.Seek(0, SeekOrigin.Begin);
    new MediaLibrary().SavePicture(name, stream);

Similar Threads

  1. CCamera: viewing captured image
    By pixsta in forum Symbian
    Replies: 5
    Last Post: 2011-02-14, 04:58
  2. sharing and sending/transfer image file between 2 devices using sockets
    By garrygar in forum Symbian Networking & Messaging (Closed)
    Replies: 3
    Last Post: 2009-01-26, 20:04
  3. Viewing image on Personal Profile
    By melas21 in forum Personal Profile
    Replies: 10
    Last Post: 2005-01-05, 11:31
  4. problems viewing an image from an URL
    By bermei in forum Mobile Java Media (Graphics & Sounds)
    Replies: 0
    Last Post: 2003-05-12, 10:07
  5. Opening a jpg image
    By kaumudi in forum Symbian
    Replies: 0
    Last Post: 2003-04-18, 12:17

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×