Open mklasen opened 1 year ago
Heya!
I noticed private attachment thumbnails are not showing when the Media library is shown in (default) grid view. I've solved this on my own environment with the following snippet;
add_filter( 'wp_prepare_attachment_for_js', array( $this, 'prepare_js_attachments' ) );
public function prepare_js_attachments( $attachment ) { $s3_uploads = \S3_Uploads\Plugin::get_instance(); if ( $s3_uploads->is_private_attachment( $attachment['id'] ) ) { if ( isset( $attachment['sizes'] ) && is_array( $attachment['sizes'] ) ) { foreach ( $attachment['sizes'] as &$size ) { $size['url'] = $s3_uploads->add_s3_signed_params_to_attachment_url( $size['url'], $attachment['id'] ); } } } return $attachment; }
Happy to provide a PR :)
Heya!
I noticed private attachment thumbnails are not showing when the Media library is shown in (default) grid view. I've solved this on my own environment with the following snippet;
add_filter( 'wp_prepare_attachment_for_js', array( $this, 'prepare_js_attachments' ) );
Happy to provide a PR :)