image_downsize example

'attachment_id'    => (string) $media_item->ID,
            'date_created_gmt' => $this->_convert_date_gmt( $media_item->post_date_gmt, $media_item->post_date ),
            'parent'           => $media_item->post_parent,
            'link'             => wp_get_attachment_url( $media_item->ID ),
            'title'            => $media_item->post_title,
            'caption'          => $media_item->post_excerpt,
            'description'      => $media_item->post_content,
            'metadata'         => wp_get_attachment_metadata( $media_item->ID ),
            'type'             => $media_item->post_mime_type,
        );

        $thumbnail_src = image_downsize( $media_item->ID, $thumbnail_size );
        if ( $thumbnail_src ) {
            $_media_item['thumbnail'] = $thumbnail_src[0];
        } else {
            $_media_item['thumbnail'] = $_media_item['link'];
        }

        /** * Filters XML-RPC-prepared data for the given media item. * * @since 3.4.0 * * @param array $_media_item An array of media item data. * @param WP_Post $media_item Media item object. * @param string $thumbnail_size Image size. */

function get_image_tag( $id$alt$title$align$size = 'medium' ) {

    list( $img_src$width$height ) = image_downsize( $id$size );
    $hwstring                         = image_hwstring( $width$height );

    $title = $title ? 'title="' . esc_attr( $title ) . '" ' : '';

    $size_class = is_array( $size ) ? implode( 'x', $size ) : $size;
    $class      = 'align' . esc_attr( $align ) . ' size-' . esc_attr( $size_class ) . ' wp-image-' . $id;

    /** * Filters the value of the attachment's image tag class attribute. * * @since 2.6.0 * * @param string $class CSS class name or space-separated list of classes. * @param int $id Attachment ID. * @param string $align Part of the class name for aligning the image. * @param string|int[] $size Requested image size. Can be any registered image size name, or * an array of width and height values in pixels (in that order). */
'full'      => __( 'Full Size' ),
        )
    );

    if ( empty( $check ) ) {
        $check = get_user_setting( 'imgsize', 'medium' );
    }

    $output = array();

    foreach ( $size_names as $size => $label ) {
        $downsize = image_downsize( $post->ID, $size );
        $checked  = '';

        // Is this size selectable?         $enabled = ( $downsize[3] || 'full' === $size );
        $css_id  = "image-size-{$size}-{$post->ID}";

        // If this size is the default but that's not available, don't select it.         if ( $size == $check ) {
            if ( $enabled ) {
                $checked = " checked='checked'";
            } else {
                
Home | Imprint | This part of the site doesn't use cookies.