Get wordpress image sizes
-
How can I get the WordPress images based on size.
By default, wp makes a thumb which is 150×150, makes a medium pic which is 640×640 and makes a large image which is 1024×1024.
Right now from my template I am doing this:
if ( class_exists('Dynamic_Featured_Image') ) { global $dynamic_featured_image; $post_more_image = $dynamic_featured_image->get_featured_images( get_the_ID() ); } if (!$post_more_image == ''){ foreach($post_more_image as $post_more_img) { $full_image = wp_get_attachment_image_src( $post_more_img['attachment_id'], 'full' ); $full_width = $full_image[1]; $full_height = $full_image[2]; ?> <div class='col-xs-6 col-sm-4 col-md-3 col-lg-2'><a href='<?php echo $post_more_img['full']; ?>' data-size='<?php echo $full_width; ?>x<?php echo $full_height; ?>' data-med='<?php echo $post_more_img['full']; ?>' data-med-size='<?php echo $full_width; ?>x<?php echo $full_height; ?>' data-author='<?php the_author_meta('display_name'); ?>' class='demo-gallery__img--main'><img class='lazy' data-original='<?php echo $post_more_img['thumb']; ?>' /><figure><?php the_title(); ?></figure></a></div> <?php }This gets the full size image fine
wp_get_attachment_image_src( $post_more_img[‘attachment_id’], ‘full’ );But then I try instead of the word full, I tried thumb, medium, large and medium, large are not working. Any suggestions? I logged in and looked at my upload and see 4 images for each picture uploaded. The full size image, the large which is 1024, and the medium which is 640 and the thumbnail which is 150
The topic ‘Get wordpress image sizes’ is closed to new replies.