1

im having a problem figuring this out. I am displaying a random post on the header of my site but the post-thumbnail looses quality when I add a custom size. How can i make it not loose quality?

This is the code in header.php

<div>
<?php
$args = array( 'numberposts' => 1, 'orderby' => 'rand', 'post_status' => 'publish', 'offset' => 1);
 $rand_posts = get_posts( $args );
 foreach( $rand_posts as $post ) : ?>
 <div class="post-thumb-title"><?php the_post_thumbnail(array(730,250)); ?>
 <p class="thumb-title"><a href="<?php the_permalink(); ?>" title="<?php the_title(); ? >"><?php the_title(); ?></a>
 <?php comments_popup_link('No Comments', '1 Comment', '% Comments'); ?></p>
 <?php endforeach; ?></div>
 </div>    

And this is the css

div.post-thumb-title {
width: 730px;
margin: 1em auto;
}

div.post-thumb-title img {
display: block;
min-width: 100%;


div.post-thumb-title p.thumb-title {
margin: 0;
height: 2em;
line-height: 2;
position: relative;
top: -2em;
max-width: 100%;
text-align: center;
 color: #fff;
background: rgba(0, 0, 0, 0.7);
}

Image quality is horrible. Am i doing something wrong or is there a fix for this? Thanks for your help

1

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.