• Dont work the_post_thumbnail(array(210,60)). The images are with size 60×60… I have searched everywhere in Google. Is there any solution?

Viewing 9 replies - 1 through 9 (of 9 total)
  • It might help if you you described the problem in a little more detail.

    Thread Starter insanoff

    (@insanoff)

    it’s my function in funtions.php

    add_theme_support('post-thumbnails');
    
    if ( function_exists('add_theme_support') ) {
        add_theme_support('post-thumbnails');
    }
    
    function get_thumbnail() {
        if ( function_exists('has_post_thumbnail') && has_post_thumbnail() ) {
            the_post_thumbnail(array(210,60), array('class' => 'attachment-60x60')); // @param: array(height, width)
        } else {
            // via mediathek
            $attachments = get_children( array(
                    'post_parent'    => get_the_ID(),
                    'post_type'      => 'attachment',
                    'numberposts'    => 1, // show all -1
                    'post_status'    => 'inherit',
                    'post_mime_type' => 'image',
                    'order'          => 'ASC',
                    'orderby'        => 'menu_order ASC'
                    ) );
            foreach ( $attachments as $attachment_id => $attachment ) {
                echo wp_get_attachment_image( $attachment_id, array(210, 60) );
            }
    
        }
    }

    and i call with <?php get_thumbnail(); ?>

    What is the output? You do realise that the image proportions will always be maintained, yes? So if the original image is square (width = height), the post thumb will also be square.

    Thread Starter insanoff

    (@insanoff)

    Thread Starter insanoff

    (@insanoff)

    Is there another way to do that?

    You could try resizing the image in the browser using CSS.

    Thread Starter insanoff

    (@insanoff)

    But this is not the correct method ))).
    Thanks…

    Right now, I can’t come up with anything better. It could be argued that stretching a 60px wide image to 210px wide isn’t the correct method either. ??

    There is an add_image_size() function that allows you to create a custom post thumbnail using either a soft (proportional crop or a hard crop but both crop modes seem to assume that the original image will be larger than the post thumb – whilst you’re doing the opposite.

    Thread Starter insanoff

    (@insanoff)

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘the_post_thumbnail(array(210,60)) dont work!!!’ is closed to new replies.