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

Issue with the 'File' custom field (missing thumb preview) #1250

Open
josefsalazar opened this issue Aug 21, 2024 · 1 comment
Open

Issue with the 'File' custom field (missing thumb preview) #1250

josefsalazar opened this issue Aug 21, 2024 · 1 comment

Comments

@josefsalazar
Copy link

Version

  • Carbon Fields: 3.6.5
  • WordPress: 6.6.1
  • PHP: 8.1

Expected Behavior

After uploading a video in a file field and refreshing the page, a thumbnail of that video should show

Actual Behavior

After uploading a video in a file field and refreshing the page, it looks as if the field is empty

Container definition

Container::make('post_meta', __('Course Details'))
            ->where('post_type', '=', 'course')
            ->add_fields(array(
                Field::make('rich_text', 'crb_course_description', __('Course Description')),
                Field::make('text', 'crb_course_price', __('Course Price'))
                    ->set_attribute('type', 'number'),

                Field::make('file', 'crb_featured_video', __('Featured Video'))
                    ->set_value_type('url')
                    ->set_type(array('video/mp4', 'video/webm', 'video/ogg')),

                // Wrap course lessons in "Section" field
                Field::make('complex', 'crb_course_sections', __('Sections'))
                    ->add_fields('section', __('Section'), array(
                        Field::make('text', 'section_title', __('Section Title')),

                        Field::make('complex', 'crb_course_lessons', __('Lessons'))
                            ->add_fields('lesson', __('Lesson'), array(
                                Field::make('text', 'lesson_title', __('Title')),
                                Field::make('textarea', 'lesson_description', __('Description')),
                                Field::make('text', 'lesson_duration', __('Duration')),
                                Field::make('file', 'lesson_video', __('Video'))
                                    ->set_value_type('url')
                                    ->set_type(array('video')),
                                Field::make('rich_text', 'lesson_wysiwyg', __('Content')),
                                Field::make('media_gallery', 'lesson_uploads', __('Uploads'))
                                    ->set_type(array('image', 'application/pdf', 'application/zip'))
                            )),
                    )),
            ));

Steps to Reproduce the Problem

  1. Upload a video file
  2. Refresh the page
  3. Check the video of that field

Comments

Though the thumbnail doesn't show, the data is still there and it works just fine if you try to use it. However, this is very misleading as anyone would think there's no data there.

I'm not exactly sure if it should show a thumbnail of the uploaded file or just an icon, but right now it shows neither

@junyaopk
Copy link

I have the same problem. I uploaded a file and there was no thumbnail, which was very misleading. It felt like the upload was not successful.

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

2 participants