WordPress.org

Ready to get started?Download WordPress

Forums

Post Thumbnail loosing Quality..Please help (2 posts)

  1. steveone86
    Member
    Posted 1 year ago #

    Hey everyone, 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

  2. Santosh
    Member
    Posted 1 year ago #

    it is depends upon the quality of images you are using in posts. use high quality images

Topic Closed

This topic has been closed to new replies.

About this Topic