• Resolved ghulst

    (@ghulst)


    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

    (@keesiemeijer)

    What theme are you using?

    possibly with css, using max-width on the img style, and height: auto;

    try to use a browser tool such as Firebug https://getfirebug.com/ to investigate which css classes are involved.

    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

    Thread Starter ghulst

    (@ghulst)

    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.

    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

    (@ghulst)

    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.