Retrieve video dimensions via Node
Hey!
I'm trying to retrieve the dimensions of a few videos I uploaded to my account through this function:
const checkImageDimensions = async (imageUrl: string) => { try { await cloudinary.uploader.explicit( imageUrl, { type: 'fetch', resource_type: 'video' }, function (error: any, result: any) { if (error) { console.log(error); } else { console.log(`${result.width}x${result.height}`); return `${result.width}x${result.height}`; } } ); } catch (error) { console.log('error', error); } };
When I execute it, I'm getting the following error:
{ message: 'Invalid value 87 for parameter type', name: 'Error', http_code: 400 }
If i remove the optional parameter 'resource_type' from my call, I get this one instead:
{ message: 'File size too large. Got 41948584. Maximum is 10485760.', name: 'Error', http_code: 400 }
I'm not trying to upload anything, and even if I were, videos aren't limited to 10MB.
I looked for some info regarding the first error and I didn't find much.
I had no problems retrieving the dimensions of my images, but I can't find a way to do the same with videos. Any ideas?
Thank you in advance.
Answers
-
Hi there,
Thanks for reaching out.
The
explicit
method is for applying actions to assets that you have previously uploaded to your account. If you are only looking to get information about an existing resource, you can use the Admin API to do that. Please refer to the following documentation for further details:
https://cloudinary.com/documentation/admin_api#resourcesPlease give this a try and let us know how it goes. If you have any questions, do not hesitate to ask.
Kind regards,
Tia
Helpful Links For You
💬 Share questions, connect with other users in our Cloudinary Community forums and Discord server!
🧑🎓 Join our Cloudinary Academy for free courses, workshops and other educational resources.
📄 Read our documentation for in-depth details on Cloudinary product features and capabilities
📰 Check out the Cloudinary blog for the latest company news and insights0 -
Hi Tia,
I got it working yesterday after a few more tries and I indeed switched to admin_api to do so.
Thank you for the quick response :)
0 -
Hi there,
My pleasure. We're here when you have questions 😊
Kind regards,
Tia
Helpful Links For You
💬 Share questions, connect with other users in our Cloudinary Community forums and Discord server!
🧑🎓 Join our Cloudinary Academy for free courses, workshops and other educational resources.
📄 Read our documentation for in-depth details on Cloudinary product features and capabilities
📰 Check out the Cloudinary blog for the latest company news and insights0