-
Notifications
You must be signed in to change notification settings - Fork 566
Description
Expected Behavior:
Images added to a file or file_list field should show a preview at the correct size (specified with preview_size).
Actual Behavior:
Regardless of the preview_size set, the preview image (that is initially added to the page via JS) is actually the full size image (the image shown after reloading the page is correct, the issue is only with the JS added image from the media window).
If preview_size is set as an array of height/width values then the full size image is resized to the correct size (resulting in squashed images):
If preview_size is set to a named size (e.g. thumbnail) then the added full size image is resized to a default of 50 x 50 px (for a file_list field) or 350 x 350 px (for a file field):
The offending code is in CMB2_Type_File_List.php line 28 and CMB2_Type_File.php line 31:
'data-previewsize' => is_array( $img_size ) ? '[' . implode( ',', $img_size ) . ']' : 350,
The numbers are hardcoded again in cmb2.js lines 223–224 and 265, but they shouldn't be an issue if the correct sizes are passed from the field.

