c# - how can i rotate image from database -



c# - how can i rotate image from database -

i want rotate image stored within database possible ? can image database don't know how rotate it.

string img = (request.querystring["cn"]); byte[] bytes = null; if (rbphoto1.checked == true) { if (img != null) { //string str = "select mem_contenttype, mem_photo tblcardrequestdetail2 mem_cardno = '" + request.querystring["cn"] + "'"; string str = "select mem_contenttype1, mem_photo1 tblphotoupload mem_cardno = '" + img + "'"; sqlcommand cmd = new sqlcommand(str); cmd.parameters.add("@1", sqldbtype.varchar).value = img; datatable dt = getdata(cmd); bytes = (byte[])dt.rows[0]["mem_photo1"]; response.outputstream.write(bytes, 0, bytes.length); response.buffer = true; response.charset = ""; response.cache.setcacheability(httpcacheability.nocache); response.contenttype = dt.rows[0]["mem_contenttype1"].tostring(); response.addheader("content-disposition", "attachment;filename=" + dt.rows[0]["mem_photo1"].tostring()); response.binarywrite(bytes); response.flush(); //response.end(); } }

you can seek below code

var memstream = new memorystream(bytes); image imgfromstream = image.fromstream(memstream, true); imgfromstream.rotateflip(rotatefliptype.rotate90flipnone); imgfromstream.save(memstream,system.drawing.imaging.imageformat.jpeg);//change whichever format need bytes = imgfromstream.toarray();

c# asp.net sql-server

Comments

Popular posts from this blog

Delphi change the assembly code of a running process -

json - Hibernate and Jackson (java.lang.IllegalStateException: Cannot call sendError() after the response has been committed) -

C++ 11 "class" keyword -