I have published a query table that contains a BLOB field to ArcGIS REST and have not been able to access the images. I tried using esriRequest, but the response type that returns is text, and I think it should be image. I don't know if this is because there is something about the files the REST service doesn't like, or if I am missing something in the code. The images are currently being served out using PHP the query the SQL database. Here is the code I am trying to use to get the images:
var imageUrl = "https://ocean.floridamarine.org/arcgis/rest/services/.../MapServer/1/7";
var params = {
url: imageUrl,
handleAs: "blob"
}
console.log("request params ", params);
var imageRequest = esriRequest(params);
imageRequest.then(requestSucceeded, requestFailed);
function requestSucceeded(response, io) {
console.log("esriRequest response ", response);
var reader = new FileReader();
if (response.type == "image/png") {
//if working with image data
reader.readAsDataURL(response);
console.log("image response ", response);
} else {
reader.readAsText(response);
console.log("reader response ", reader.readAsText(response));
}
};
function requestFailed(error, io) {
temp = temp + "<br/><div style='text-align:center;'><strong>No Image Available</strong></div>";
console.log(error);
}
The url points to this, but not sure if I should be seeing an image here:
Here is a screenshot of the console:
As you can see, the response type is text (should be seeing an image?)
What I am doing wrong? Is a better way to go about this?