• OK so what im trying to do is have ten post entries display with each one having a different thumbnail size.

    So the first entry would be size = tile_one
    the second entry would be size = tile_two
    And so on

    I have set up the custom sizes here

    //Setting Up Images sizes
    if( FALSE === get_option("tile_one_size_w") )
    {
    	add_option("tile_one_size_w", "313");
    	add_option("tile_one_size_h", "176");
    	add_option("tile_one_crop", "1");
    
    	add_option("tile_two_size_w", "147");
    	add_option("tile_two_size_h", "176");
    	add_option("tile_two_crop", "0");
    
    	add_option("tile_three_size_w", "147");
    	add_option("tile_three_size_h", "176");
    	add_option("tile_three_crop", "0");
    
    	add_option("tile_four_size_w", "311");
    	add_option("tile_four_size_h", "374");
    	add_option("tile_four_crop", "0");
    
    	add_option("tile_five_size_w", "644");
    	add_option("tile_five_size_h", "177");
    	add_option("tile_five_crop", "0");
    
    	add_option("tile_six_size_w", "313");
    	add_option("tile_six_size_h", "334");
    	add_option("tile_six_crop", "0");
    
    	add_option("tile_seven_size_w", "482");
    	add_option("tile_seven_size_h", "176");
    	add_option("tile_seven_crop", "0");
    
    	add_option("tile_eight_size_w", "147");
    	add_option("tile_eight_size_h", "176");
    	add_option("tile_eight_crop", "0");
    
    	add_option("tile_nine_size_w", "312");
    	add_option("tile_nine_size_h", "129");
    	add_option("tile_nine_crop", "0");
    
    	add_option("tile_ten_size_w", "312");
    	add_option("tile_ten_size_h", "129");
    	add_option("tile_ten_crop", "0");
    
    	add_option("header_image_size_w", "640");
    	add_option("header_image_size_h", "0");
    	add_option("header_image_crop", "0");
    }
    else
    {
    	update_option("tile_one_size_w", "313");
    	update_option("tile_one_size_h", "176");
    	update_option("tile_one_crop", "0");
    
    	update_option("tile_two_size_w", "147");
    	update_option("tile_two_size_h", "176");
    	update_option("tile_two_crop", "0");
    
    	update_option("tile_three_size_w", "147");
    	update_option("tile_three_size_h", "176");
    	update_option("tile_three_crop", "0");
    
    	update_option("tile_four_size_w", "311");
    	update_option("tile_four_size_h", "374");
    	update_option("tile_four_crop", "0");
    
    	update_option("tile_five_size_w", "644");
    	update_option("tile_five_size_h", "177");
    	update_option("tile_five_size_crop", "0");
    
    	update_option("tile_six_size_w", "313");
    	update_option("tile_six_size_h", "334");
    	update_option("tile_six_size_crop", "0");
    
    	update_option("tile_seven_size_w", "482");
    	update_option("tile_seven_size_h", "176");
    	update_option("tile_seven_size_crop", "0");
    
    	update_option("tile_eight_size_w", "147");
    	update_option("tile_eight_size_h", "176");
    	update_option("tile_eight_size_crop", "0");
    
    	update_option("tile_nine_size_w", "312");
    	update_option("tile_nine_size_h", "129");
    	update_option("tile_nine_size_crop", "0");
    
    	update_option("tile_ten_size_w", "312");
    	update_option("tile_ten_size_h", "129");
    	update_option("tile_ten_size_crop", "0");
    
    	update_option("header_image_size_w", "640");
    	update_option("header_image_size_h", "0");
    	update_option("header_image_crop", "0");
    }
    
    function additional_image_sizes( $sizes )
    {
    	$sizes[] = "tile_one";
    	$sizes[] = "tile_two";
    	$sizes[] = "tile_three";
    	$sizes[] = "tile_four";
    	$sizes[] = "tile_five";
    	$sizes[] = "tile_six";
    	$sizes[] = "tile_seven";
    	$sizes[] = "tile_eight";
    	$sizes[] = "tile_nine";
    	$sizes[] = "tile_ten";
    	$sizes[] = "header_image";
    
    	return $sizes;
    }
    add_filter( 'intermediate_image_sizes', 'additional_image_sizes' );

    and im trying to display them with this code to no avail

    <?php if(have_posts()) : ?><?php while(have_posts()) : the_post(); ?>
    <a href="<?php the_post_thumbnail( 'tile_one', 'tile_two' and so on ); ?>"</a>
    <?php endwhile; ?>
    <?php endif; ?>

    Any help would be much appreciated

Viewing 1 replies (of 1 total)
  • Not quite sure what you want, but try code like this:

    update_option('tile-sizes',
       array(
          array( 111, 121 ), // tile 1 sizes
          array( 211, 221 ), // tile 2 sizes
          array( 51, 81 ),   // tile 3 sizes
       )
     );
    query_posts('posts_per_page=3&ignore_sticky_posts=1');
    $tile_sizes = get_option('tile-sizes');
    $post_counter = 0;
    if (have_posts()) {
       while (have_posts()) {
          the_post();
          $this_size = $tile_sizes[$post_counter++];
          // print_r("<p>ID: $post->ID COUNTER:$post_counter SIZES:");print_r($this_size); print_r('<br />');
          the_post_thumbnail($this_size);
       }
    }
Viewing 1 replies (of 1 total)
  • The topic ‘Post thumbnail sizes in array’ is closed to new replies.