WP7 set Image to source behind a HttpBasicAuthenticator - silverlight

i am trying to set an image in a Windows Phone 7 App, there is a problem thoug, the url where the image is located required Authenticator, i have a valid username and password, but i have no idea how to load the image thoug an URI with the Authenticator?
ProfileImage.Source = new BitmapImage(new Uri(userObject.ProfileImage));

Unless you can use a authentication url, ie. http://username:password#domain.tld/image.png then you need to download the image locally first, and then load it afterwards.
You could write a custom handler for it, that downloads it to the Isolated Storage, and then automatically updates the UI, while using a fallback image (typically blank) while loading it.

Related

Sharing image on Instagram iOS, sometimes gets the last image from the gallery and not the downloaded image

I'm using this code to download the image of an uri and then pass it to the function that opens Instagram like a UImage.The problem comes when I try to share another image, the application gets me the last image that I use, and not the one that I'm downloading or selecting, and I trying to delete this local file, but I can't remove it.
https://learn.microsoft.com/en-us/answers/questions/577839/sharing-image-on-instagram-ios-something-get-the-l.html

Saving an image captured using ngCordova and Ionic (file service)

I want to save an Image I captured using ngCordova camera plugin in Ionic platform. I know how to capture the image but the Image is gone when I reopen the mobile app. I want the user to be able to take a picture that replace an existing one and also to be able to override that picture if she/he clicks the button again.
My problem is I cannot use cordova file service and local storage to store the image.
refer to Store Image into internal Storage in Ionic?

Changing Silverlight Application name dynamically

I'm creating a deployable module where some parts are written in Silverlight, and I'm making the SL application deployable for OOB usage. However, I want to make Silverlight take the name of the website that it's deployed from, such as, when a user installs it from Example.com, I want to have "example.com application" with the site's own icon in the shortcut. Is there any "supported" method of doing this, or will I be going with locating the XAP file and manually changing AppManifest.xaml inside it?
You will need to find out your URL of your application:
string appURL = Application.Current.Host.Source.AbsoluteUri.Substring(0, Application.Current.Host.Source.AbsoluteUri.IndexOf(#"ClientBin/"));
So this will solve the title problem, next is the icon. You could load the image from the page:
Uri uri = new Uri(String.Format("{0}/favicon.png", appURL));
IconImage.Source = new BitmapImage(uri);
It's not perfect, you will have to manipulate appURL to get the domain name only.

Cross-site images in Silverlight

Is it possible to load in an image from another domain using JavaScript, and then pass the image to a Silverlight control on my page?
The only workaround I'm familiar with for this, since it's a security issue, is to set up a web service on a server you have control over, request the image from this web service from your Silverlight application, then have the service grab the image from the other server and return it to the client.
Loading cross-domain images should not be an issue in Silverlight, at least if you are using the normal Image control. I just tested this with a really simple application containing only an Image control with the Source property set to an image from google images.
Are you loading your images in some funky way with the WebClient? Cross-scheme and cross-zone access is restricted for the Image class, so you would not be able to load an image (on any domain) over SSL if you loaded your XAP over regular HTTP.
The MSDN page on Silverlight URL Access Restrictions gives you a good overview of what you can and cannot do with Image, MediaElement, WebClient, and streaming video.

Opening an image on demand with Silverlight 2 WebClient

I'm trying to show some images on my silverlight application whenever user wants to. The images are in a folder in my silverlight project and I don't want the user to download all of them when he/she loads the web page for the first time.
I have tried the OpenReadAsync method with a relative address to the image file which is in a folder named images and its Build Action is set to Content and also its "Copy to Output Direcoty" property is set to Always.
But I get the following exception in the OpenReadCompleted event:
The URI prefix is not recognized.
Here is the code I used:
Dim webClient As New WebClient
AddHandler webClient.OpenReadCompleted, AddressOf webClient_OpenReadCompleted
WebClient.AllowReadStreamBuffering = True
WebClient.OpenReadAsync(New Uri("images/myimage.jpg", UriKind.Relative))
Can anyone tell me how can I solve this problem?
Thanks
To start with take the images out of the silverlight project. You want the images to be in the web project then you can use a normal image tag with an empty source, then when you need to download the image set the source to the uri.

Resources