Skip to content
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

Vimeo::uploadImage() method doesn't seem to work #25

Closed
mnori opened this issue Sep 5, 2014 · 4 comments
Closed

Vimeo::uploadImage() method doesn't seem to work #25

mnori opened this issue Sep 5, 2014 · 4 comments

Comments

@mnori
Copy link

mnori commented Sep 5, 2014

I have been trying to use the uploadImage() method to add a thumbnail to a video that has been uploaded, but not yet finished processing. I'm passing in these parameters:

uploadImage("https://api.vimeo.com/videos/{$videoID}", $filename);

When I do this, I get a VimeoUploadException with message 'Unable to request an upload url from vimeo'.

I looked a bit further by debuglogging the $pictures_response variable (which is set on line 356 of Vimeo.php) and got this:

[2014-09-05 12:26:01] local.DEBUG: Array
(
    [body] => 
    [status] => 0
    [headers] => Array
        (
        )

)

Is this a bug, or am I doing something wrong?

Also is uploadImage intended to be used to upload video thumbnails? Is this expected to work for videos that have not yet finished processing?

Thanks!

Matt

@Dashron
Copy link
Contributor

Dashron commented Sep 5, 2014

Have you been able to make other requests, such as $vimeo->request("/me")?

A status of 0 usually means the request never reached our server, which usually means there is an issue with certificates. Take a look at http://unitstep.net/blog/2009/05/05/using-curl-in-php-to-access-https-ssltls-protected-sites/ for more information, I do not recommend the easy fix (it's insecure).

If that doesn't solve the problem, try adding some curl debugging with http://php.net/manual/en/function.curl-error.php

@Dashron
Copy link
Contributor

Dashron commented Sep 9, 2014

Hi,

Have you made any progress with this issue?

Thanks!

@mnori
Copy link
Author

mnori commented Sep 10, 2014

Hi,

I tried $vimeo->request("/me") which worked great (got some details about my profile).

I then discovered that I was setting $pictures_uri in uploadImage() wrong - I had set it to https://api.vimeo.com/videos/105769240 when it should have been /videos/105769240 (I think?)

With the latter set, I got the "Unable to request an upload url from vimeo" exception, and this response:

(
    [body] => 
    [status] => 405
    [headers] => Array
        (
            [Date] => Wed, 10 Sep 2014 15
            [Server] => Apache
            [Allow] => GET,DELETE,PATCH,OPTIONS
            [Cache-Control] => max-age=315360000
            [Expires] => Sat, 07 Sep 2024 15
            [Vary] => Accept-Encoding
            [Content-Length] => 0
            [Content-Type] => application/json
        )
)

This is interesting since in the code it's a POST request. Am I using the wrong endpoint?

I also tried /videos/105769240/pictures as the endpoint parameter - this gave me a list of thumbnail sizes, but did not seem to upload the picture.

Matt

@Dashron
Copy link
Contributor

Dashron commented Sep 10, 2014

The $pictures_uri should match the pictures connection in a clip response. It usually looks like "/videos/105769240/pictures".

$lib->uploadImage($clip['metadata']['connections']['pictures']['uri'], $path)

  • or -
    $lib->uploadImage('/videos/105769240/pictures', $path)

A POST request will be made against that url (https://github.com/vimeo/vimeo.php/blob/master/vimeo.php#L354) and it should give you a new single picture response, with the necessary informatoin to perform the upload.

Everything will be handled for you in the uploadImage method, and it will return a uri, pointing to the new image resource (/videos/[id]/pictures/[id])

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants