Skip to content

How to Upload and apply PRE or POST transformation ? #59

@MistaIA

Description

@MistaIA

As specified in your README:

Use the options parameter to pass other parameters supported by the ImageKit Upload API. Use the same parameter name as specified in the upload API documentation.

However, there is no transformation argument in UploadFileRequestOptions class for PRE or POST TRANSFORMATION as specified in the Server Side Upload API documentation: https://docs.imagekit.io/api-reference/upload-file-api/server-side-file-upload#endpoint

It must be like this if there was:

from imagekitio import ImageKit
from imagekitio.models.UploadFileRequestOptions import UploadFileRequestOptions


imagekit_api = ImageKit(
    private_key='private_key',
    public_key='public_key',
    url_endpoint='endpoint'
)

transformation = {
    'pre': 'du-10',     # Considering it is a video file
    'post': [
        {
            'type': 'transformation',
            'value': 'w-512,h-512'    # just somehow
        },
    ]
}

options = UploadFileRequestOptions(transformation=transformation)

result = imagekit_api.upload_file(file='b64|path|binary', file_name='filename', options=options)

print(result.url)

But instead, there is an error UploadFileRequestOptions.__init__() got an unexpected keyword argument 'transformation'

So, please, did I miss something? Is there a coming soon release about that?

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