douzhicong5965 2017-05-19 14:04
浏览 63

无法更改ACF Gallery图像大小

I don't know how to change the size of images in my gallery. I've tried putting a class on the images and using css to change the size which doesn't work as the class is just ignored. I've also tried changing the size using thumbnail, medium and large but the image wont grow any bigger than 150px by 150px. How can I change the image sizes and make them responsive?

<div class="container">
    <div class="row">
        <div class="col-md-12">
            <?php 

            $image_ids = get_field('gallery', false, false);

            $shortcode = '[gallery ids="' . implode(',', $image_ids) . '"]';

            echo do_shortcode( $shortcode );

            ?>

            <?php 

            $images = get_field('gallery');

            if( $images ): ?>

                <ul class="row">
                    <?php foreach( $images as $gallery_images ): ?>
                        <li class="col-md-4">
                            <a href="<?php echo $gallery_images['url']; ?>">
                                 <img src="<?php echo $gallery_images['sizes']['medium']; ?>" alt="<?php echo $gallery_images['alt']; ?>" />
                            </a>
                            <p><?php echo $gallery_images['caption']; ?></p>
                        </li>
                    <?php endforeach; ?>
                </ul>
            <?php endif; ?>
        </div>
    </div>
</div>
  • 写回答

2条回答 默认 最新

  • duanhuang7591 2017-05-19 14:39
    关注

    You can try adding your own image sizes to your functions.php. Here is the manuel: WordPress add_image_size() function. You will have to re-upload your images since it wont regenerates the thumbnails automatically.

    After that add class="img-responsive" to your img element which bootstrap uses for responsive images.

    评论

报告相同问题?

悬赏问题

  • ¥20 求各位懂行的人,注册表能不能看到usb使用得具体信息,干了什么,传输了什么数据
  • ¥15 个人网站被恶意大量访问,怎么办
  • ¥15 Vue3 大型图片数据拖动排序
  • ¥15 Centos / PETGEM
  • ¥15 划分vlan后不通了
  • ¥15 GDI处理通道视频时总是带有白色锯齿
  • ¥20 用雷电模拟器安装百达屋apk一直闪退
  • ¥15 算能科技20240506咨询(拒绝大模型回答)
  • ¥15 自适应 AR 模型 参数估计Matlab程序
  • ¥100 角动量包络面如何用MATLAB绘制