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

Invalid Image File #8

Closed
valboivin opened this issue Jan 24, 2024 · 5 comments
Closed

Invalid Image File #8

valboivin opened this issue Jan 24, 2024 · 5 comments
Labels
enhancement New feature or request

Comments

@valboivin
Copy link

Hi there!

Seems like some file formats are not supported via uploads in the plugin. For instance, I can easily upload a JSON file directly in our Cloudinary account, but not via our Craft CMS admin panel. I get an "Invalid image file" error.

To fix it on my part, I've added 'resource_type' => 'auto' to the $uploadOptions object of the writeFileFromStream function.
(I could probably also add this parameter to the write function.)
With this change, I can upload my JSON file without any problem.

I'm wondering if that could be a nice addition or if there's a better way to do this.

Thanks

@thomasvantuycom
Copy link
Owner

Hi Valerie,

Currently, the plugin exclusively handles image files. I've been actively working on expanding its compatibility to encompass all file types, but that's still in progress. The Cloudinary API poses challenges in how it distinguishes between images, videos, and other assets, making the task of ensuring seamless operation across all file types quite intricate. While extending support to all file types comes with drawbacks such as a noticeable rise in rate-limited API calls, I believe the benefits outweigh the challenges. I aim to complete the implementation within the next two weeks, although I can't make a definitive promise at this time.

@thomasvantuycom thomasvantuycom added the enhancement New feature or request label Jan 24, 2024
thomasvantuycom added a commit that referenced this issue Jan 26, 2024
@thomasvantuycom
Copy link
Owner

The issue has been addressed and incorporated into version 1.6.0, which is now available.

@valboivin
Copy link
Author

@thomasvantuycom thank you so much, that was quick! 😄

One last thing regarding your changes. I feel like you've forgotten to parse the variable in the creation of the Cloudinary Adapter instance.

The asset uploaded on the Cloudinary account doesn't have the right url:
screenshot 2024-01-26 at 2 02 12 PM

On the CloudinaryFS file, I think it should be like this:

return new CloudinaryAdapter($client, App::parseEnv($this->baseFolder), null, $this->dynamicFolders);

@thomasvantuycom
Copy link
Owner

Well darn, I've made the same mistake for the nth time.

@valboivin
Copy link
Author

Happens to the best of us! 😄

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

No branches or pull requests

2 participants