kirupha karan
kirupha karan

Reputation: 3

xamarin.forms Storing and retrieving image files using sqlite

Currently i working in storing images (using ImageSource element) in sqlite. I am reading files from local directory after that i trying to storing the images into sqlite but i can't able to store the images . can any one help me to store. also how to convert image source as bytes in xamarin.forms

Here my code snap

Interface
 Task<Product> AddToDo(string title, string subtitle,ImageSource img);

Calling method
ImageFile = ImageSource.FromFile("Chinese_6_600_C.jpg");

await azureService.AddToDo(Title, Subtitle, ImageFile);


public async Task<Product> AddToDo(string title, string subtitle, ImageSource img)

{

await Initialize();

 var item = new Product     
{

Title=title,

Subtitle=subtitle,

 ImageFile= img

 };


//TODO 5: Insert item into todoTable

await todoTable.InsertAsync(item);

//Synchronize todos

await SyncToDos();

return item;

 }

Here i have imported the nuget packages '( Microsoft.WindowsAzure.MobileServices.SQLiteStore)' for storing data between sqlite and azure cloud store. When i inserting imagesource into ' (await todoTable.InsertAsync(item)'it was not accepting. Please help me For handling this situation

Upvotes: 0

Views: 3135

Answers (0)

Related Questions