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

Add support for folders #12

Closed
wants to merge 2 commits into from
Closed

Add support for folders #12

wants to merge 2 commits into from

Conversation

eithed
Copy link

@eithed eithed commented Jun 12, 2019

Per #4

This will allow users to define what folder on Cloudinary given field should upload to. While default folder where the file is stored is set to be '/' in Laravel\Nova\Fields\File ($storagePath), one can override this behaviour by extending CloudinaryImage and defining $storagePath within the constructor.

@m2de
Copy link
Contributor

m2de commented Jun 17, 2019

Hi. Thanks very much for your contribution. I will try and pull this into a couple of projects when I get a chance to test it out but all looks good as far as I can tell without trying it.

@bboure
Copy link

bboure commented Oct 5, 2019

Any chance this can get merged soon?


$options = ['public_id' => $path, 'resource_type' => 'auto'];

if ($folder != '.') {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does pathinfo always return a . for dirname if the file is in the cwd?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As far as I remember, yes

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking at https://www.php.net/manual/en/function.dirname.php this could be a . / or \?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When I was running it on mac (or Heroku) it was .. I don't have access to Windows machine to check what happens there

@m2de
Copy link
Contributor

m2de commented Oct 18, 2019

Have not yet had a chance to fully test this. Can anyone confirm if this works with nested folders? IIRC there are some limitations on Cloudinary but there is no validation going on here. Does Cloudinary throw an error and we don't need to worry about additional validation or will things just not work as expected. Happy to merge if someone can clarify some of these edge cases.

@eithed
Copy link
Author

eithed commented Oct 18, 2019

We're currently using this approach and it does work for nested folders; indeed there's no validation, but I don't think it's required as all it's doing is passing additional parameters straight into Cloudinary PHP package, but I do admit that I've not tested what will happen if I'll try to upload file into !@#$%^&*() folder

@pa-bouly
Copy link

Hi, any update about this PR ? I would be interested by this feature :)

@carnevalle
Copy link

Try to check out #16 for an implementation of not only folders but all the optional parameters.

@eithed eithed closed this Jul 27, 2020
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

Successfully merging this pull request may close these issues.

5 participants