Upload resized image in wordpress

0

Good evening. I'm trying to load only the "thumbnails" of the images in my custom page, however the site loads the original image and resizes it. This is loading my site.

My code:

<?php if ( $the_query->have_posts() ): ?>
    <div class="row" id="products">
        <?php while ( $the_query->have_posts() ): ?>
            <?php $the_query->the_post(); ?>
            <div class="col-xs-12 col-sm-4 col-md-3 product" alt="<?php get_the_title() ?>" title="<?php get_the_title() ?>">
                <div class="change">
                    <i class="fa fa-undo" aria-hidden="true"></i>
                </div>
                <a href="<?php echo get_permalink() ?>">
                    <?php if(types_render_field('lancamento')=="Sim"): ?>
                    <div class="new <?php echo strtolower(types_render_field('tipo')) ?>">
                        <h1>Lançamento</h1>
                    </div>
                    <?php endif; ?>
                    <div class="img top">
                        <img alt="<?php get_the_title() ?>" title="<?php get_the_title() ?>" src="<?php echo types_render_field("logo", array("width"=>"200","height"=>"200", "raw" => "true")); ?>" class="img-responsive"/>
                    </div>
                    <div class="img botton">
                        <img alt="<?php get_the_title() ?>" title="<?php get_the_title() ?>" src="<?php echo types_render_field("miniatura", array("size"=>"medium", "raw" => "true")); ?>" class="img-responsive"/>
                    </div>
                </a>
            </div>
        <?php endwhile; ?>
    </div>
<?php endif; ?>

The divs "img top" and "img botton" and my 2 tests did not work, they are the loading blocks of the images, however, the result is not what I wanted.

Pictures:

    
asked by anonymous 05.05.2018 / 03:13

1 answer

0

I do not know if this is the case, but when you upload the images via the Wordpress media library, it creates several versions of the image with different dimensions in the wp-content/uploads directory.

Make sure there are these variations. From there, simply adapt your code to get the version of the image in the size that suits you best.

    
05.05.2018 / 07:15