htmlburger/carbon-fields

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

Opened this issue · 1 comments

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

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.