Bug 27700 - Issue in Writing and Reading Image Files
Summary: Issue in Writing and Reading Image Files
Status: RESOLVED NORESPONSE
Alias: None
Product: Forms
Classification: Xamarin
Component: Forms ()
Version: 1.3.3
Hardware: PC Windows
: Normal normal
Target Milestone: ---
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2015-03-05 10:31 UTC by Anubhav Ranjan
Modified: 2016-04-08 20:01 UTC (History)
6 users (show)

Tags: images io
Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED NORESPONSE

Description Anubhav Ranjan 2015-03-05 10:31:26 UTC
One of the customers is facing the issue in Reading and Writing the image file.

#Description: 
 am trying to retreive an image from a securised web page. I have to build
a web request with credentials and I want to download the image and read it
later. If I call the URL of the webservice in my browser I have the good
image which is displayed in the browser.
Following examples found in the net or in Xamarin forums I tried something
but there is no image displayed, it's just blank and I get these messages :
*[skia] --- SkImageDecoder::Factory returned null*
*[OpenGLRenderer] TextureCache::get: create texture(0xb93baee8): name,
size, mSize = 762, 16384, 2731408*

This is my code :

*Saving*
*...*
*WResponse = (HttpWebResponse)WRequest.GetResponse();*
*using (Stream stream = WResponse.GetResponseStream())*
*{*
* StreamReader reader = new StreamReader(stream, Encoding.UTF8);*
* responseString = reader.ReadToEnd();*
* byte[] imgBytes = Convert.FromBase64String (EncodeTo64(responseString));*
* var documentsPath = Environment.GetFolderPath
(Environment.SpecialFolder.Personal);*
* var filePath = Path.Combine (documentsPath, filename); // var **filename
= "photo_"+id+".jpg"; at the top of the method*
* File.WriteAllBytes (filePath, imgBytes);*
*}*
*WResponse.Close();*
*...*

*Reading*
*public static ImageSource loadImage(int id)*
*{*
* var filename = "photo_"+id+".jpg";*
* byte[] imgBytes;*
* ImageSource imgSource;*
* var documentsPath = Environment.GetFolderPath
(Environment.SpecialFolder.Personal);*
* var filePath = Path.Combine (documentsPath, filename);*

* using (var fs = new FileStream (filePath, FileMode.Open,
FileAccess.Read)) {*
* var imageData = new byte[fs.Length];*
* fs.Read (imageData, 0, (int)fs.Length);*
* imgSource = ImageSource.FromStream (() => new MemoryStream (imageData));*
* }*
* return imgSource;*
*}*

​The point is, as I have to call a webservice to get the image, I must get
it from the stream of the ​WResponse... Could you help me please ?
Comment 2 Rui Marinho 2015-05-21 20:43:33 UTC
Thank you for taking the time to submit the bug. We tried to reproduce the issue you reported but were unable given the description. If you could please attach a reproduction to the bug by starting with a clean Xamarin.Forms project and adding just the code necessary to demonstrate the issue we would very much appreciate it. We monitor recently touched NEEDS INFO bugs so we’ll notice you attached the reproduction we’ll take it from there. 

Warm regards,
Xamarin Forms Team
Comment 3 Bryan Hunter 2016-04-08 20:01:46 UTC
Thank you for your bug report. As we have not received the information requested, we cannot properly triage your bug and are marking it resolved.

Warm regards,
Xamarin Forms Team