Forum Xamarin Xamarin.Forms

How to display image in mobile

AustyAusty Member ✭✭✭

l am consuming an api hosted on my local computer in my mobile app. l have successfully displayed other attributes except such as title,date_created but am having a challenge displaying the image. l saved the image in a folder and saved the path to the image in the database. l got the path to the image by clicking on the image in visual studio. l copied the full path and saved in the database. the image is not displaying. Is there a reason why.

This is the full path in the database

Best Answer


  • AustyAusty Member ✭✭✭

    thanks @JohnH. l could not embed the image into the solution. l attempted embedding the image into the solution by selecting the image and setting build action to embedded didn't work. so l decided to host the image on a web server and saved the url in the database. That worked perfectly. Question is why did the embedded option not work.

    l got the full path of the image by right clicking on the image and clicking on properties. l then copied the value of full path and saved in the db. Below is what l saved in the db
    C:\Users\SBSC QA TEAM\source\repos\FINALKAHPROJECT\FINALKAHPROJECT\FINALKAHPROJECT\wwwroot\images\spider.jpeg.

    Is this the issue..if yes how do l get the path.thanks

  • JohnHJohnH GBMember ✭✭✭✭✭

    Take a look at the Xamarin examples on embedding images, the process is different on each platform. The original path og where the file was at compile time makes no difference to the location where the file is embedded, so it wouldn't have that path.

Sign In or Register to comment.