Answer the question
In order to leave comments, you need to log in
How can I resize the_post_thumbnail() images to 100% width and 512px height so the image quality doesn't get squished?
If I use this code, then the image is flattened. How to do so that it does not flatten?
<?php get_header() ?>
<?php
the_post(); ?>
<?php $image_id = get_post_thumbnail_id(); ?>
<?php $image_attributes = wp_get_attachment_image_src( $image_id, 'full'); ?>
<img src="<?php echo $image_attributes[0]; ?>" width="100%" height="512px">
<?php
the_title('<h1 class="post-title">', '</h1>');
echo '<div class="post-content">';
the_content();
echo '</div>';
?>
<?php get_footer() ?>
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question