Open mschfh opened 1 month ago
Hi @mschfh what part are you referring to when you say "When accessing the raw content of the file", do you mean like this implementation ? https://github.com/KalvadTech/django-cloudflare-images/blob/main/cloudflare_images/storage.py#L93-L99
Yes, or accessing it via the file attribute: https://github.com/KalvadTech/django-cloudflare-images/blob/b7451e23e4b74558c0211e873ba5400dd4997ded/cloudflare_images/storage.py#L28-L36 https://github.com/KalvadTech/django-cloudflare-images/blob/b7451e23e4b74558c0211e873ba5400dd4997ded/cloudflare_images/service.py#L64-L77
Hi @mschfh i am not too sure how to do this without breaking the current code - what is your use case for getting the raw image ?
I need to copy it to a different model / modify it, IMHO the variant URL is only useful for serving it to the end user.
As the field stores the raw image, it should be possible to read the same image back.
Would you accept a patch with an env var that uses the blob
API call instead of the variant URL here?
https://github.com/KalvadTech/django-cloudflare-images/blob/30833e17ff32f5a117bf72658939a635f3b6539f/cloudflare_images/service.py#L64-L77
When accessing the raw content of the file (using
my_image.file
), it should return the original version/base image instead of the variant (the resized/optimized version should be accessed/linked viaurl
): https://developers.cloudflare.com/api/operations/cloudflare-images-base-image