c# - What do i have to do to display this as an image? -


i dont know have do. here's code when searching image:

public actionresult searchimage() {         var path = @"\\jesus-pc\frontera\imagenes\singnos distintivos\0\80hp23891268272.tif";     filestream stream = new filestream(path,filemode.open,fileaccess.read);     byte[] data = new byte[(int)stream.length];     stream.read(data,0, data.length);      return json(new { base64image = convert.tobase64string(data) }, jsonrequestbehavior.allowget); } 

i ajax:

$(".doc").dblclick(function () {                       $.ajax({         url: "mainpage/searchimage",         contenttype: 'application/json',         datatype: "json",         type: "get",         success: function (data) {             modalwindow.open();             document.getelementbyid("img_1").src =                  "data:image/jpeg;base64"+data.base64image;         }  }) 

but here's in browser:

{ base64image: "sukqaegaaabxqu5hifrjrkygaqawaaaavgl0bgu6aef1dghvcjoau3viamvjddoas2v5d29yzhm6aenvbw1lbnrzogaaaaaaegd+aaqaaq... aafxeaaa==" }

i believe you're looking for.

can asp.net mvc controller return image?

this has nothing base 64 encoding image. base 64 encoding work, if that's want, looks want deliver image server rendered in client. can using fileresult.

in case, image's src tag should src="mainpage/searchimage", , existing code-behind should replaced following:

public actionresult searchimage(string id) {     var path = @"\\jesus-pc\frontera\imagenes\singnos distintivos\0\80hp23891268272.tif";     return base.file(path, "image/tiff"); } 

Comments

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -

node.js - Bad Request - node js ajax post -