Delete an Image in the MediaLibrary - c#

I was wondering if it is possible to programmatically delete an image within the MediaLibrary. Currently I am using the CameraCaptureTask to capture an image and save, but I would like to be able to delete that image as well. Also, editing an image would be another consideration. Note, I am working with Windows Phone 8.

No, you can't programmatically delete images from the users Pictures MediaLibary.
"There is no way to delete any content from the user's library. Once you've saved a picture, the user will always have that picture unless they personally go delete it."
(Source Delete image from MediaLibrary.SavePictures).
If you need the ability to delete stored images you could store them in isolated storage and then have an option to publish them to the Media Library.

Related

How to move file loaded into windows forms imagebox to another folder?

I am working on a program in C# and Windows Forms that will display an image in .tiff format in an imagebox and the user will decide with one of the 3 buttons to which folder to move the displayed image.
The problem is that I can't find a method that will move the loaded file to another folder with the button. Does anyone know the solution to this problem?
And my second, optional question, is it possible that after moving the .tiff file to another folder, another one will be automatically loaded into the imagebox? All .tiff will be in the same folder.
Here is all that I already have GITHUB LINK

best way to display images android?

I am developing an android application and I have to display images in it. This image is uploaded from a c# application and I need to retrieve it to android client.
I am trying by loading the image into the DataBase and retrieveing it from android, but this takes much memory and I need a better way to do it.
This c# application is allocated into the server so maybe a good way is to store the images and access to the path from the android client, but is it possible to public an image in my server?
Further, which one you think is the best way to do it?
Thank you.
If I understand you correctly: You upload a picture using a C# program which stores the image (as binary data) in the database?
I would recommend to store the image on the filesystem and the (relative) path to the image in the database. Your Android clients get the URL of the picture and can download and display the image.
There are (very good) Android libraries for displaying images from URLs. Take a look at this library: Android-Universal-Image-Loader.
I will recommend you to store image file to server, and add its path to database.
The easiest ways to display image in your android app is using Picasso Library.
Download Picasso library from here
Add it to your build path. Import this library to your code file.
For loading image from web url:
String url = "http://example.com/image.png"
Picasso.with(getApplicationContext()).load(url).into(imageView);
For loading image from drawable:
Picasso.with(getApplicationContext()).load(R.drawable.imageFile).into(imageView);
Here, imageView is the name of variable you are using to represent ImageView. Eg.
ImageView imageView = (ImageView) findViewById(R.id.ImageView1);
To use Picasso with ImageButton, change imageView variable to imageButton variable
ImageButton imageButton = (ImageButton)findViewById(R.id.imageButton);

Automatically add and delete images in WP7 app storage

I want to make a "recent pages" section in my WP7 app which will show thumbnails of 6 recent browsed pages. How to make a method which saves only 6 image files in the storage and when new ones come replace old ones with it?
Assuming that you define "new" based on the date/time that the image file in IsolatedStorage was created you could determine this by querying GetCreationTime on the file.
You can use IsolatedStorageFile.GetFileNames to determine how many / which files exist. Note: you probably want to create these files in a specific folder so you don't have to worry about other files in IsolatedStorage.

Displaying images in a list box keeps files locked

I have a list box of images which I am adding programatically from my my pictures directory. I want to be able to put images in the directory and the UI displays it automatically. I also want to be able to remove photos from the directory and have the UI update as well but the problem is that the images are being used by the application so I am not able to remove the images from the directory. Is there a way to unlock the files so I can rename and remove files from the directory?
Are you using data binding like Image Source = {Binding FilePath} ? If so, you need to load the image with CacheOption = BitmapCacheOption.OnLoad, you can do it declaratively with a ValueConverter, like this one:
http://soulsolutions.com.au/wpf-reference-an-image-without-a-file-lock/
Do you load images with Image.FromFile? I've noticed this behavior a long time ago. Try opening the files with File.Open, loading the images with Image.FromStream, then close the stream.

Combining URL text box with FileUpload control

I'm developing a web app which allows users to upload images. Instead of forcing them to first download an image I also want to allow them to provide a URL of the image elsewhere on the web.
I've got the code to do this, my question is how can I combine these into one text box that will allow the user to enter either the location of the image on their hard drive or the location of the image on the web.
I'm aware of the ASP File Upload control - but how could I leverage it to do this?
Let them choose like you can here at StackOverflow? (try to add an image to an answer; you get the same option).

Categories

Resources