How to get response while uploading jpg using django
Hi I need to upload jpg's from drive to cloudinary i've used a code from documentation:
cloudinary.uploader.upload(
file_path,
public_id='allegro/{}/{}'.format(folder, filename),
crop='limit',
width=500,
height=500,
eager=[
{'width': 200, 'height': 200,
'crop': 'thumb', 'gravity': 'face',
'radius': 20, 'effect': 'sepia'},
{'width': 100, 'height': 150,
'crop': 'fit', 'format': 'jpg'}
]
)
It works great but i don't get any response and i have to extract url of the image file uploaded, please help me with that.
-
Hi Alo,
Are you storing the response from the upload call? You should be able to do something like so to extract the URL from the response:
res = cloudinary.uploader.upload(
file_path,
public_id='allegro/{}/{}'.format(folder, filename),
crop='limit',
width=500,
height=500,
eager=[
{'width': 200, 'height': 200,
'crop': 'thumb', 'gravity': 'face',
'radius': 20, 'effect': 'sepia'},
{'width': 100, 'height': 150,
'crop': 'fit', 'format': 'jpg'}
]
)
img_url = res['url']
If you're already doing this can you provide the whole script you're using to upload? If privacy is a concern, you can also open a support ticket with us at https://support.cloudinary.com/hc/en-us/requests/new.1
Post is closed for comments.
Comments
1 comment