-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Upload image issue #37
Comments
I see they changed the response schema in the documentation and the error message you posted, but I can not get a response in that shape. Anyway, I know how to fix that (one more enum variant here: https://github.com/Lurk/cloudinary_rs/blob/main/src/upload/result.rs#L27). I'm still trying to figure out how to test, though. |
i have trield to update the code structure here base on the response , and its working fine, with a success response casting to UploadResult success Response, here is what i have tries to change and update . #[derive(Clone, Deserialize, Debug)] #[derive(Clone, Deserialize, Debug)] pub async fn image(&self, src: Source, options: &UploadOptions<'_>) -> Result {
i have changes the structure and upload image function. |
Hey @DhvaniBhesaniya, please check the latest version. https://crates.io/crates/cloudinary/0.6.0 I haven't found where this change is documented, but all new Cloudinary accounts get the response in the new shape, while old accounts still get it in the old shape. |
According to you new version update ERROR - failed to parse: {"asset_id":"c38a161953bc4a6c7472a7c04a44577b","public_id":"oujlo7tngcrq9pneavst","version":1728536861,"version_id":"4c797b517cf0d5adbf3d0d196d3bfcb0","signature":"149de0e119e1d7970782d16506cfb87c4706000f","width":274,"height":184,"format":"jpg","resource_type":"image","created_at":"2024-10-10T05:07:41Z","tags":[],"bytes":4365,"type":"upload","etag":"f2e60e6cfdb2d4e3e48f2a117faaa34d","placeholder":false,"url":"http://res.cloudinary.com/djigcn0dy/image/upload/v1728536861/oujlo7tngcrq9pneavst.jpg","secure_url":"https://res.cloudinary.com/djigcn0dy/image/upload/v1728536861/oujlo7tngcrq9pneavst.jpg","asset_folder":"","display_name":"oujlo7tngcrq9pneavst","api_key":"427982931967"} Caused by: i have tries to change the response structure according to the cloudinary response schema , see comment . |
Hey, @DhvaniBhesaniya, please check the next version https://crates.io/crates/cloudinary/0.7.0 😀 |
i am using the upload method just as instructed but i am getting this parse error. uploading is working fine , in the cloudinary it is being uploaded. i am using data url as a source to upload the image.
here is the error :
"
Upload result :: , Err(failed to parse:
{"asset_id":"c49b1d4902a9dfc2bfee942a38d675c0","public_id":"pwoyepnl4re9skaban5j","version":1728368129,"version_id":"d12154246f5b4b4fe949d8f6ddb8d59f","signature":"209f3fc898796e3d82d59cc6e193f4c544aa39cb","width":223,"height":226,"format":"png","resource_type":"image","created_at":"2024-10-08T06:15:29Z","tags":[],"bytes":4824,"type":"upload","etag":"0652a25b4542ff8a0312f814c6c9a8b1","placeholder":false,"url":"http://res.cloudinary.com/djigcn0dy/image/upload/v1728368129/pwoyepnl4re9skaban5j.png","secure_url":"https://res.cloudinary.com/djigcn0dy/image/upload/v1728368129/pwoyepnl4re9skaban5j.png","asset_folder":"","display_name":"pwoyepnl4re9skaban5j","api_key":"4273989199567"}
Caused by:
data did not match any variant of untagged enum UploadResult)
"
for now i have done like if it is ok then from the success response i will takew the secure url , but if this error comes i am extracting the secure url from the error msg, which in coding sense not good , can you help me to solve this error ,
here below is my code.
pub async fn upload_image_to_cloudinary(profile_img: &str) -> Result<String, String> {
let cloud_name = gett::("CLOUDINARY_CLOUD_NAME");
let api_key = gett::("CLOUDINARY_API_KEY");
let api_secret = gett::("CLOUDINARY_API_SECRET");
}
can you check if there is any problem ?.
The text was updated successfully, but these errors were encountered: