smeevil / cloudex

An elixir library which helps with uploading image files or urls to cloudinary
Do What The F*ck You Want To Public License
103 stars 64 forks source link

Support for videos #45

Closed suranyami closed 6 years ago

suranyami commented 6 years ago

Cloudinary has support for video uploads by passing the parameter `"resource_type" => "video".

This requires a different URL for the POST request:

https://api.cloudinary.com/v1_1//video/upload

I'm in the process of adding this in our fork, and will push a PR as soon as there is a working version.

suranyami commented 6 years ago

@smeevil We've got a tentative first step on this branch here:

https://github.com/visual-amplifiers/cloudex/tree/feature/video-upload

Unfortunately, it's failing when signing the request. We get this error:

  1) test upload single video file (CloudexTest)
     test/cloudex/cloudex_test.exs:23
     match (=) failed
     code:  assert {:ok, %Cloudex.UploadedImage{}} = Cloudex.upload("test/assets/teamwork.mp4", %{resource_type: "video"})
     right: {:error,
             "Invalid Signature 3b51489e06ec14993a64635f9fe30636696314f8. String to sign - 'timestamp=1535005387'."}
     stacktrace:
       test/cloudex/cloudex_test.exs:25: (test)

Have you encountered this before? I've gone through the documentation and read through the cloudinary_gem ruby code, but I'm none the wiser. Current guess is that there are parameters that need to be added to the signature for video uploads specifically, but we can't seem to track down which ones.

suranyami commented 6 years ago

Also: was able to re-record the exvcr cassettes, but it was a bit klutzy: used my own credentials, then did a multi-file search/replace on api_key, cloud_name, secret to make them generic.

Is there a way we could automate that?

suranyami commented 6 years ago

This is fixed in the PR referenced above, @smeevil

smeevil commented 6 years ago

\o/ merged updated and published