wp_maybe_generate_attachment_metadata example

<?php
        if ( $open ) {
            wp_image_editor( $attachment_id );
        }

        ?> </div> <?php     elseif ( $attachment_id && wp_attachment_is( 'audio', $post ) ) :

        wp_maybe_generate_attachment_metadata( $post );

        echo wp_audio_shortcode( array( 'src' => $att_url ) );

    elseif ( $attachment_id && wp_attachment_is( 'video', $post ) ) :

        wp_maybe_generate_attachment_metadata( $post );

        $meta = wp_get_attachment_metadata( $attachment_id );
        $w    = ! empty( $meta['width'] ) ? min( $meta['width'], 640 ) : 0;
        $h    = ! empty( $meta['height'] ) ? $meta['height'] : 0;

        
Home | Imprint | This part of the site doesn't use cookies.