I have a lot of images stored in a folder on the server side. The database has the URL of each image. I cannot open the image directly from the client side because the client side does not have permission to do it.
The image is being searched by an AJAX call and when the user clicks the bottom, a modal window fades in and so should the image, but it doesn't. I was not sure if the images could be found so I used console.log to see what value it's getting and a lot of symbols are being returned which makes me think that it is because of the file format.
Here's the AJAX call:
$.ajax({
url: "mainpage/SearchImage",
data: "",
type: "post",
success:function(data){
$("#img_1").css("src","data:image/tiff;base64,"+data);
console.log(data);
}
})
The actionresult that searches for the images is:
public ActionResult SearchImage() {
var path = @"\\jesus-pc\Frontera\IMAGENES\SINGNOS DISTINTIVOS\0\75HP23891268272.TIF";//the url is static cuz it just a test to know how to display the image
var img = base.File(path, "image/tiff");//this file format is valid, right?
return img;
}
But as I said, it can find it, but it prints out a lot of symbols, not in the #img_1 img tag but in the console.
How can I fix this?
I'm using MVC 4 and C#.