c# - System.Drawing.Image.FromStream invalid parameter -


i'm trying blob database i'm getting error "invalid parameter"

in line

system.drawing.image objimg = system.drawing.image.fromstream(blobstream, true); 

here code:

public partial class showblob : system.web.ui.page {       private system.drawing.image.getthumbnailimageabort delegateabort;      protected void page_load(object sender, eventargs e)      {          // handle on account, create blob service client , container proxy          var account = cloudstorageaccount.parse(roleenvironment.getconfigurationsettingvalue("conn"));          account.createcloudtableclient().createtableifnotexist("tablename");          var client = account.createcloudblobclient();          cloudblobcontainer container = client.getcontainerreference("tablename");          string id = request["id"].tostring();           // retrieve reference blob named "myblob"          cloudblob blob = container.getblobreference(id);          blobstream blobstream = blob.openread();           if (request["imgvd"] == "0")          {              response.contenttype = "image/jpeg";              system.drawing.image objimg = system.drawing.image.fromstream(blobstream, true);               if (request["thumb"] != null)                  objimg = objimg.getthumbnailimage(140, 210, delegateabort, system.intptr.zero);               objimg.save(response.outputstream, imageformat.jpeg);          } 

and have image stored because have add using method:

if (filefoto.hasfile)       try      {          cloudblobclient blobclient = account.createcloudblobclient();          // retrieve reference container           cloudblobcontainer container = blobclient.getcontainerreference("tablename");          // create container if doesn't exist          container.createifnotexist();          cloudblob blob = container.getblobreference("c" + viewstate["id"].tostring());                         blob.uploadfromstream(filefoto.postedfile.inputstream);      } 

i solved problem. problem set reference

cloudblob blob = container.getblobreference("c" + viewstate["id"].tostring()); 

when upload photo , take using

cloudblob blob = container.getblobreference(viewstate["id"].tostring()); 

Comments

Popular posts from this blog

jquery - How can I dynamically add a browser tab? -

keyboard - C++ GetAsyncKeyState alternative -

android - java.net.UnknownHostException(Unable to resolve host “URL”: No address associated with hostname) -