Title: Resizing images when using php get_template_part
Last modified: August 20, 2016

---

# Resizing images when using php get_template_part

 *  Resolved [ghulst](https://wordpress.org/support/users/ghulst/)
 * (@ghulst)
 * [13 years, 9 months ago](https://wordpress.org/support/topic/resizing-images-when-using-php-get_template_part/)
 * Hi,
 * I am playing around with a template, but it shows my featured images at full 
   size. Not something I am very pleased with. In the template they pull in the 
   images using:
 * `<?php get_template_part( 'featured', 'image' ); ?>`
 * My question is, how can I resize the images if above a maximum size so I can 
   upload pictures that are bigger without needing to resize every time?

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

 *  Moderator [keesiemeijer](https://wordpress.org/support/users/keesiemeijer/)
 * (@keesiemeijer)
 * [13 years, 9 months ago](https://wordpress.org/support/topic/resizing-images-when-using-php-get_template_part/#post-2970073)
 * What theme are you using?
 *  [Michael](https://wordpress.org/support/users/alchymyth/)
 * (@alchymyth)
 * [13 years, 9 months ago](https://wordpress.org/support/topic/resizing-images-when-using-php-get_template_part/#post-2970074)
 * possibly with css, using `max-width` on the img style, and `height: auto;`
 * try to use a browser tool such as Firebug [http://getfirebug.com/](http://getfirebug.com/)
   to investigate which css classes are involved.
 *  [Max](https://wordpress.org/support/users/clementsm/)
 * (@clementsm)
 * [13 years, 9 months ago](https://wordpress.org/support/topic/resizing-images-when-using-php-get_template_part/#post-2970186)
 * Also, if it is a featured image for a post, you can just add a custom image size
   in `functions.php` and call that custom image size by name. You will of course
   have to rebuild all your thumbnails first, but that would be more efficient that
   using the browser to resize.
 * Refer to: [Post Thumbnails](http://codex.wordpress.org/Post_Thumbnails)
 *  Thread Starter [ghulst](https://wordpress.org/support/users/ghulst/)
 * (@ghulst)
 * [13 years, 9 months ago](https://wordpress.org/support/topic/resizing-images-when-using-php-get_template_part/#post-2970308)
 * Thanks Max. That sounds like the best idea so far.
 * Alchymyth; Trouble is that the width of the column allows images to be huge if
   they are in portrait. So I would much rather go for maximum height than maximum
   width.
 * Keesiemeijer; I am using the Best theme.
 *  [Michael](https://wordpress.org/support/users/alchymyth/)
 * (@alchymyth)
 * [13 years, 9 months ago](https://wordpress.org/support/topic/resizing-images-when-using-php-get_template_part/#post-2970316)
 * > So I would much rather go for maximum height than maximum width.
 * and what is the problem with that?
 * have you tried `max-height: 500px;` and `width: auto;` ??
 * ideally, post a link to your site to illustrate the issue.
 *  Thread Starter [ghulst](https://wordpress.org/support/users/ghulst/)
 * (@ghulst)
 * [13 years, 9 months ago](https://wordpress.org/support/topic/resizing-images-when-using-php-get_template_part/#post-2970319)
 * There is no problem with that. In fact, I have solved the problem altogether,
   but in a different way.
 * I decided that I didn’t mind a bit of cropping on resizing and so I have ditched
   the original function and added the post thumbnail to functions.php. That allowed
   me to set the thumbnail size and call that from the template.

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

The topic ‘Resizing images when using php get_template_part’ is closed to new replies.

## Tags

 * [featured image](https://wordpress.org/support/topic-tag/featured-image/)
 * [resize](https://wordpress.org/support/topic-tag/resize/)
 * [show](https://wordpress.org/support/topic-tag/show/)

 * 6 replies
 * 4 participants
 * Last reply from: [ghulst](https://wordpress.org/support/users/ghulst/)
 * Last activity: [13 years, 9 months ago](https://wordpress.org/support/topic/resizing-images-when-using-php-get_template_part/#post-2970319)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
