public function add_intermediate_mgmt_fields($form_fields, $post = null)
    {
        $current_screen = \get_current_screen();

        if (isset($current_screen->base) && $current_screen->base === 'post') {
            return $form_fields;
        }

        // Only display for admin level users, and only if an image.
        if (\strpos(\wp_get_referer(), 'upload.php') !== false
            && \wp_attachment_is_image($post->ID)
            && \current_user_can('manage_options')
        ) {
            $meta = wp_get_attachment_metadata($post->ID);

            $public_sizes = \array_diff(get_intermediate_image_sizes(), Size_Manager::get_dynamic_sizes());

            $output = '<hr><p><strong>Generated sizes:</strong></p>';

            if (!empty($meta['sizes'])) {
                $output .= '<table class="widefat fixed striped media">
                    <thead>
                        <tr style="display:table-row;">
                            <td class="manage-column column-cb check-column">
                                <input id="delete-intermediate-all" type="checkbox">
                            </td>
                            <th>Name</th>
                            <th>Width</th>
                        </tr>
                    </thead>
                    <tbody>';

                foreach ($meta['sizes'] as $key => $value) {
                    if (\in_array($key, $public_sizes)) {
                        continue;
                    }

                    $output .= '<tr style="display:table-row;"><th class="check-column">';
                    $output .= '<input type="checkbox" name="[delete-intermediate][]" value="'.$key.'">';
                    $output .= '</th><td>'.$key.'</td><td>'. $value['width'] . 'x' . $value['height'].'</td></tr>';
                }

                $output .= '</tbody></table>
	                <button type="button" style="margin-top: 5px;" class="button-link delete-intermediate-button">Delete selected sizes</button>';
            }

            $form_fields['generated_sizes'] = [
                'input' => 'html',
                'tr' => $output,
            ];
        }

        return $form_fields;
    }
public function add_intermediate_mgmt_fields($form_fields, $post = null)
    {
        $current_screen = \get_current_screen();

        if (isset($current_screen->base) && $current_screen->base === 'post') {
            return $form_fields;
        }

        // Only display for admin level users, and only if an image.
        if (\strpos(\wp_get_referer(), 'upload.php') !== false
            && \wp_attachment_is_image($post->ID)
            && \current_user_can('manage_options')
        ) {
            $meta = wp_get_attachment_metadata($post->ID);

            $public_sizes = \array_diff(get_intermediate_image_sizes(), Size_Manager::get_dynamic_sizes());

            $output = '<hr><p><strong>Generated sizes:</strong></p>';

            if (!empty($meta['sizes'])) {
                $output .= '<table class="widefat fixed striped media">
                    <thead>
                        <tr style="display:table-row;">
                            <td class="manage-column column-cb check-column">
                                <input id="delete-intermediate-all" type="checkbox">
                            </td>
                            <th>Name</th>
                            <th>Width</th>
                        </tr>
                    </thead>
                    <tbody>';

                foreach ($meta['sizes'] as $key => $value) {
                    if (\in_array($key, $public_sizes)) {
                        continue;
                    }

                    $output .= '<tr style="display:table-row;"><th class="check-column">';
                    $output .= '<input type="checkbox" name="[delete-intermediate][]" value="'.$key.'">';
                    $output .= '</th><td>'.$key.'</td><td>'. $value['width'] . 'x' . $value['height'].'</td></tr>';
                }

                $output .= '</tbody></table>
	                <button type="button" style="margin-top: 5px;" class="button-link delete-intermediate-button">Delete selected sizes</button>';
            }

            $form_fields['generated_sizes'] = [
                'input' => 'html',
                'tr' => $output,
            ];
        }

        return $form_fields;
    }
public function add_intermediate_mgmt_fields ( $ form_fields , $ post = null ) { $ current_screen = \ get_current_screen ( ) ; if ( isset ( $ current_screen -> base ) && $ current_screen -> base === 'post' ) { return $ form_fields ; } // Only display for admin level users, and only if an image. if ( \ strpos ( \ wp_get_referer ( ) , 'upload.php' ) !== false && \ wp_attachment_is_image ( $ post -> ID ) && \ current_user_can ( 'manage_options' ) ) { $ meta = wp_get_attachment_metadata ( $ post -> ID ) ; $ public_sizes = \ array_diff ( get_intermediate_image_sizes ( ) , Size_Manager :: get_dynamic_sizes ( ) ) ; $ output = '<hr><p><strong>Generated sizes:</strong></p>' ; if ( ! empty ( $ meta [ 'sizes' ] ) ) { $ output .= '<table class="widefat fixed striped media">
                    <thead>
                        <tr style="display:table-row;">
                            <td class="manage-column column-cb check-column">
                                <input id="delete-intermediate-all" type="checkbox">
                            </td>
                            <th>Name</th>
                            <th>Width</th>
                        </tr>
                    </thead>
                    <tbody>' ; foreach ( $ meta [ 'sizes' ] as $ key => $ value ) { if ( \ in_array ( $ key , $ public_sizes ) ) { continue ; } $ output .= '<tr style="display:table-row;"><th class="check-column">' ; $ output .= '<input type="checkbox" name="[delete-intermediate][]" value="' . $ key . '">' ; $ output .= '</th><td>' . $ key . '</td><td>' . $ value [ 'width' ] . 'x' . $ value [ 'height' ] . '</td></tr>' ; } $ output .= '</tbody></table>
	                <button type="button" style="margin-top: 5px;" class="button-link delete-intermediate-button">Delete selected sizes</button>' ; } $ form_fields [ 'generated_sizes' ] = [ 'input' => 'html' , 'tr' => $ output , ] ; } return $ form_fields ; }
Output the HTML for the dynamic image management.

@since 1.0.0

@param  array    $form_fields The current output.
@param \WP_Post $post The current attachment.
@return mixed
Output the HTML for the dynamic image management .