Have a user upload an image to the Android Resources/drawable folder - c#

I need the user to be able to upload an image, and then have the image be able to be accessed later for drawing it. I only know how to show an image in the Android Resources/drawable folder. I don't think it is possible for a user to upload an image there, so is there another place they can upload it, and then have the image to be used? I don't know how to have the user to be able to upload it either.
I only know how to show an image with the xaml code <Image Source="image.png"/>, where image.png is in the Android Resources/drawable folder

Since Resources contained in out raw directory of our project will be packaged inside our APK and will not be writeable at runtime.
So I highly recommend that you use Internal or External Data Storage to store your images and text file.
For more details, you can check: https://learn.microsoft.com/en-us/xamarin/android/platform/files/
And at the bottom of this page:External storage, there is a example which function is to save text file in External storage, it should be helpful for you.
The sample link is here: https://github.com/xamarin/monodroid-samples/tree/master/LocalFiles
If you want to choose Photos and Video, you can use MediaPlugin of jamesmontemagno. Of course , you can achieve this function yourself.

Related

Process Start to open image file in resources folder

I have a C# program that I need to embed an image into or perhaps better stated make the exe file portable such that the image will open on any computer and I need the image to open up in the default picture viewer (not a form PictureBox). I do have the image in the resource folder with 'Embed Resource'
System.Diagnostics.Process.Start = WindowsFormsApplication5.Properties.Resources.MyImage;
I realize the above code is invalid, but I am just a coding hobbyist, so I don't know everything. If I could get a little push in the right direction, I would appreciate it.
This might do the trick for you but If you want a Default Image Viewer to open a picture, you need to store that image to somewhere on your disk, thus the Image Viewer could find and open your picture.
var bitmap = new Bitmap(WindowsFormsApplication5.Properties.Resources.MyImage);
bitmap.Save("YourImageLocation");
Process.Start("YourIamgeLocation");

UWP (C#) - Where and how should files be saved and accessed?

Where and how should files be saved and accessed, e.g. Images downloaded by my application and then visible from my app.
Scenario:
I give my app URLs to images placed online on random places. The app downloads them and saves them "somewhere". Saved images are used as news article images in my app. Files should be accessible in the Photos app.
Save your data to ApplicationData.LocalFolder, it is intended for exactly this. But your data will not be visible outside your app. If you want to make some photos accessible in the Photos app, you need to save them to the Windows.Storage.KnownFolders.PicturesLibrary folder.

Copying video file from Project package to Isolated Storage during run-time

I require to play a short video in my WP8 application. Unfortunately, there is no API available for playback from MediaLibrary.
The only API I know of is as per this link:
http://msdn.microsoft.com/en-us/library/windowsphone/develop/hh394041(v=vs.105).aspx
The above method works only if the VideoFile is stored in Isolated Storage.
While I understand that I can upload files to Isolated Storage using some tools, I would rather prefer to package the Video file inside the xap, and then copy the file to Isolated Storage during run-time.
Can someone please guide me on copying a VideoFile included in Application project to Isolated Storage during run-time.
You can add a video as an app asset the same way as you add an image. Add video to your project and mark it as Content. The video will be packaged with the app in xap.
You accomplish this with the MediaElement control. Here is a great sample on how to use it. The basics is to add it to your xaml and set the source to a file that is has the build action set to content.
<MediaElement x:Name="VidoPlayer" Source="/Assests/MyVideo.wma" AutoPlay="True" Volume="1"/>
So as long as you have a file MyVideo.wma located in the Assests folder and the Build Action is set to Content, you're golden!

Upload and justify the image position of profile pic in asp.net

Need the upload profile feature with following functionality:
Uploaded image validations. (type, size)
Save the image in a different directory.
After uploading user should be able to re-position the image properly, so that the avatar looks
properly aligned as the users wants.
Crop the image.
What are the solutions to implement this in ASP.Net with C# ?
for croping image please read these article
article
codeplex
there will be problems if you save image to different folders ie folder permission the domain host companies do give permission read only if you save it to another folder you have to give permissions to each folder. there is another way you make a root folder with read and write permissions and then in that folder save your username name of folder
you can get the size and width and height if you use valum

how to manage image file in c# for asp.net mvc web-application

How to manage user picture in c# for my web application
i want all images as
1.png 2.png 3.png if user upload GIF and jpeg that it is convert to .png
how i can do this.
Phil Haack just wrote about Uploading a file (or files) with ASP.NET MVC.
This will give you a good starting place with your image upload requirements.
Once you've obtained the image from the user you can name it anything you like before saving. You could store all images together and link the user to the image via a database entry or you could create a user image folder and store the image in there.
There's a huge variety of ways you can accomplish your goal so these are just a couple of sugestions to help you along the way.

Categories