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

Image uploads in JSON field? #86

Open
PaulLawton227 opened this issue May 3, 2019 · 3 comments
Open

Image uploads in JSON field? #86

PaulLawton227 opened this issue May 3, 2019 · 3 comments
Labels
request New feature or request

Comments

@PaulLawton227
Copy link

Lovin' your work on this JSON field.
Do you have any plans to make Image uploads inside the JSON field (ideally your NovaImageCropper)?

@beliolfa
Copy link
Contributor

Hey! Sorry about the delay.

Can you provide a real world example of sending an image inside a JSON field? Currently we are sending a strinigify json to the server and this is not possible. But maybe we could think a way to achive this feature.

Thanks!

@PaulLawton227
Copy link
Author

We have an instructor with basic name, handle, email and a metafield for storing all the extra data that defines an instructor.

e.g.

JSON::make( __('Metafields'), [
                Text::make(__('Title'), 'title'),
                Text::make(__('Previous Job Title'), 'previous_job_title'),
                Text::make(__('Instagram Handle'), 'instagram_handle'),
                Textarea::make(__('Quote'), 'quote'),
                Repeater::make(__('Key stats'), 'key_stats')
                    ->addField([
                        'label' => 'Stat.',
                        'name' => 'stat',
                        'type' => 'text',
                    ]),
            ], 'metafields'),

inside this json field - we would want to add a photo field e.g.

            ImageCropper::make('photo')
                ->aspectRatio(1)
                ->maxWidth(800),

and any number of 'additional' images e.g. image_1, image_2.
We'd like these images to go in the metafields - so that we don't have to keep adding extra image fields into the database migrations when the client says "can we have another image?"

@beliolfa
Copy link
Contributor

hmm so im thinking on adding a new method like ->sendAsArray() or similar that allow us to send Files in the formData. The default behavior in JSON field is flat all the fields in a JSON stringified string.

I'll think about it. PRs welcome!

@beliolfa beliolfa added the request New feature or request label May 10, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
request New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants