SomeStudent
SomeStudent

Reputation: 3048

Xamarin Image Source

Apologies if this was asked before.

I am having a rather simple issue, and I am wondering if i am missing something obvious. In my practice Xamarin.Forms app, I am having issue loading the following image source URI: http://lorempixel.com/1920/1080/sports/7/ even though when i go there via my browser; it is fine.

It seems to me like Xamarin needs an image extension for it to work, so for example if i were to have some sort of image online like (https://www.stickpng.com/assets/images/58b061138a4b5bbbc8492951.png , fair warning; this link will download the cat image if you go to it) then it loads up fine.

My question is two fold: Am I missing something simple in my configuration that I need to enable (this is for Android as I don't have an iOS device available atm), and B: Does xamarin even support relative paths?

Code Behind:

var source = new UriImageSource 
{ 
    Uri = new Uri("http://lorempixel.com/1920/1080/sports/7/")
};

source.CachingEnabled = false;

ImageOne.Source = source;

Upvotes: 0

Views: 182

Answers (1)

Brandon Minnick
Brandon Minnick

Reputation: 15342

Explanation

Both iOS & Android now require https:

Answer

It should be an easy fix - change http to https:

var source = new UriImageSource 
{ 
    Uri = new Uri("https://lorempixel.com/1920/1080/sports/7/")
};

source.CachingEnabled = false;

ImageOne.Source = source;

Upvotes: 2

Related Questions