Title: WordPress image resize
Last modified: August 20, 2016

---

# WordPress image resize

 *  Resolved [Dediux](https://wordpress.org/support/users/dediux/)
 * (@dediux)
 * [14 years ago](https://wordpress.org/support/topic/wordpress-image-resize/)
 * Hi,
 * My problem it’s about the thumbnails resizing option via functions.php.
    The 
   site [c-comunicazione.ch](http://www.c-comunicazione.ch) use a lot of network
   resource for loading images because these are resizing with the function:
 * <?php the_post_thumbnail(‘tiny-thumb’); ?>
 * The ‘tiny-thumb’ is an image size that I’ve added to my admin panel for manage
   the various size better.
 * When i run the Google PageSpeed tool, it tell me I’ve to offer scaled images.
   As obvious for this reason my website it’s taking a lot of time for loading.
 * In my upload folder I’ve the full sized image file, the normal size (width = 
   500px) and the tiny (width = 180px), but when I call the thumbnail with the wordpress
   function, the script don’t use the tiny file, but the full sized one. It only
   add a line of code for specify the height and width, and don’t use the scaled
   version.
 * Sorry for my language errors! I hope the problem it’s clear.

Viewing 8 replies - 1 through 8 (of 8 total)

 *  [s_ha_dum](https://wordpress.org/support/users/apljdi/)
 * (@apljdi)
 * [14 years ago](https://wordpress.org/support/topic/wordpress-image-resize/#post-2788662)
 * You did something [like](http://codex.wordpress.org/Post_Thumbnails#Add_New_Post_Thumbnail_Sizes)
   this to add a new thumbnail size?
 *  Thread Starter [Dediux](https://wordpress.org/support/users/dediux/)
 * (@dediux)
 * [14 years ago](https://wordpress.org/support/topic/wordpress-image-resize/#post-2788668)
 * Exactly the same!
 *  [s_ha_dum](https://wordpress.org/support/users/apljdi/)
 * (@apljdi)
 * [14 years ago](https://wordpress.org/support/topic/wordpress-image-resize/#post-2788678)
 * Interesting… have you tried passing it a size array instead of a name?
 *  Thread Starter [Dediux](https://wordpress.org/support/users/dediux/)
 * (@dediux)
 * [14 years ago](https://wordpress.org/support/topic/wordpress-image-resize/#post-2788751)
 * It work now!
    But what’s the difference?
 *  [s_ha_dum](https://wordpress.org/support/users/apljdi/)
 * (@apljdi)
 * [14 years ago](https://wordpress.org/support/topic/wordpress-image-resize/#post-2788771)
 * I can’t say without seeing your code and playing around a little bit. Sounds 
   like the thumbnail size didn’t get set correctly for some reason, but that is
   a guess.
 *  Thread Starter [Dediux](https://wordpress.org/support/users/dediux/)
 * (@dediux)
 * [14 years ago](https://wordpress.org/support/topic/wordpress-image-resize/#post-2788778)
 * In my function.php file I have these line of code:
 *     ```
       // Enable thumbnails
       add_theme_support( 'post-thumbnails' );
       set_post_thumbnail_size(180, auto, true); // Normal post thumbnails
   
       // Create custom sizes
       // This is then pulled through to your theme useing the_post_thumbnail('custombig');
       if ( function_exists( 'add_image_size' ) ) {
       	add_image_size('single-post-thumbnail', 500, auto, true); //narrow column
       }
   
       //Custom admin sizes
       add_image_size('tiny-thumb', 180, auto, true);
       add_image_size('normal-thumb', 500, auto, true);
   
       function custom_wmu_image_sizes($sizes) {
              unset( $sizes['thumbnail']);
              unset( $sizes['medium']);
              unset( $sizes['large']);
   
              $myimgsizes = array(
                     "tiny-thumb" => __( "Miniatura" ),
                     "normal-thumb" => __( "Normale" ),
              );
              $newimgsizes = array_merge($sizes, $myimgsizes);
              return $newimgsizes;
       }
       add_filter('image_size_names_choose', 'custom_wmu_image_sizes');
       ```
   
 * And in my index.php I have these:
 *     ```
       <?php the_post_thumbnail( array(180,auto) ); ?>
       ```
   
 * To recall the function!
 * I think the problem was in the first two rules of my function file telling that
   the thumbnail size has to have 180, auto, true… It’s possible?
 * And how can I get a output code without the specification of height and width
   for my img elements? Because now the elements contain already a resized img.
 *  [s_ha_dum](https://wordpress.org/support/users/apljdi/)
 * (@apljdi)
 * [14 years ago](https://wordpress.org/support/topic/wordpress-image-resize/#post-2788782)
 * I’m not sure it ‘auto’ is a valid value for the third parameter. (It might be,
   but I’m not sure. I’d have to look into it more.) Some of these image functions
   use PHP’s GD library to actually create new images. ‘auto’ may not work. Again,
   I’m not sure. I’d have to play with it some and try to trace where those values
   are used, and I don’t have that kind of time. Maybe someone else knows though.
 *  Thread Starter [Dediux](https://wordpress.org/support/users/dediux/)
 * (@dediux)
 * [14 years ago](https://wordpress.org/support/topic/wordpress-image-resize/#post-2788787)
 * I use the value auto with the array and it work! Only the string ‘normal-thumb’
   in the place of that array doesn’t work. Thank you very much for the help and
   for the free time you have donated to me.
 * Regards

Viewing 8 replies - 1 through 8 (of 8 total)

The topic ‘WordPress image resize’ is closed to new replies.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 8 replies
 * 2 participants
 * Last reply from: [Dediux](https://wordpress.org/support/users/dediux/)
 * Last activity: [14 years ago](https://wordpress.org/support/topic/wordpress-image-resize/#post-2788787)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
