I am calling an API on Azure, that itself is calling a thumbnail (Jpeg) using this API:
https://api-portal.videoindexer.ai/docs/services/Operations/operations/Get-Video-Thumbnail/console
However, the results come out like below:
����Lavc58.18.100��C
���
1!QAa"q2B���R�#3br��u�����S6C$%��5�cts�T&D4��U��d���e!1AQa2"q�#����3��B���X"��?��!=��W�u�ٗ�-2���?����ۯ�Կ�i���t����M���Y�-��-Vdϊ�P�<�<U#TY]K��dW
���
�ϥ�U�{,!<�J�¶ȵ��k$e�9-[b��&��e�-�ϑ"�V��m�,�]4,m��]-�,�Є(�4-X��H�-���"�Bҋ-E�$l�Ѯ
y�ÃU�Ltj��+b�cu����d�u��8x_{'w��)���Z��ز,�@�D]D�l[t"�2�,Qd^��)f��b�aB�@�!�!�!�!�!�!�!�!�!5�.x-���@-X�*!�$������O����c���f
���5���v�{t���$�U��~���m��j_�����W�
���K
I am calling the video indexer API above (in the backend) and defining var img = <img src=\"${result}\">
where result
is effectively the characters above (which I have shortened), but should be the image.
I then want to show this on a web page, currently, I am attempting to use:
context.res = {
body: img,
headers: {
'Content-Type': 'text/html; charset=utf-8'
}
}
I have also attempted to use:
context.res = {
body: img,
headers: {
'Content-Type': 'image/Jpeg'
}
}
where var img = result
but it is not working - when calling my API on web it is returning the symbols in the example above and not the image.
I believe the issue is in the way I am handling the image in the backend, and passing it along as symbols as opposed to the image being passed along, (perhaps encoding?), but I haven't had to deal with something like this before.
Any tips on how to go forward?
I am using MS Azure and node.js.