Skip to content

Getting image to display on WebPage #53

@AlfredoPagano

Description

@AlfredoPagano

Hi all,

im using python as backend calling ISILON API and i want display an image on the front-end webpage with Svelte NodeJS.

I have this function in the backend where the requested filename could be JPG, PNG or TIF file.

Is this the correct way to get an image or maybe the head should contain the 'Content-Type' : 'image/octet-stream' ?
Is the returned image a buffer of bytes?
What is the best way to use the output of this API ?

def getFileTextOperation(request, Response, api):
    currentpath = request.args.get("dir", default="")
    filename = request.args.get("filename", default="")                    
    if filename is None: #basic checks on provided input
        return Response("filename must be provided", status=400)
    if currentpath is None: #basic checks on provided input
        return Response("currentpath must be provided", status=400)

     head = {
            'x-isi-ifs-target-type': "object"
        }
    data = api.session.api_call("GET","/namespace/ifs/data/"+currentpath+"/"+filename, headers = head)
    return data

Thanks in advance,
Alfredo.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions