如何加快加载大量图像的页面加载时间

时间:2019-01-05 22:49:26

标签: php performance

在页面上运行该页面时,页面加载和暂停需要很长时间,然后一次显示所有内容,我有什么方法可以斋戒?

我尝试过的操作是将该部分保存为.html并从那里显示仍然没有什么不同,还尝试使用lozad.js加载图像仍然可以做到这一点

<div class='person-videos-text'>    
            <div class="row">

            <?php
                while($row = mysqli_fetch_assoc($recentTreningVideos))
                {
                    $TrendImageURL = $row['youtubethumbnail'];
                    $TrendSongName = $row['musicvideotitle'];
                    $TrendCleanSongname = $row['songname'];

                    $name = $row['youtubethumbnail'];

                    $rippedUrl = explode("/",$name);

                    //print_r($rippedUrl);

                    $hostt = $rippedUrl[0];
                    $hostUrl = $rippedUrl[2];
                    $imageNameVi = $rippedUrl[3];
                    $imageNameUrl = $rippedUrl[4];
                    $imageType = $rippedUrl[5];
            ?>

             <div class="column trending">
                <div class="card">
                <a href="viewactors.php?songname=<?php echo $TrendCleanSongname; ?>">
                  <img class="trending-image-size" src="cached/<?php echo $imageNameUrl;?>/<?php echo $imageType; ?>" alt="John">
                  <div class="person-container">
                    <!--<h2>John Doe</h2>-->
                    <p class="title trending-title"><?php echo $TrendSongName; ?></p>
                    <!--<p>Some text that describes me lorem ipsum ipsum lorem.</p>
                    <p>example@example.com</p>
                    <p><button class="button">Contact</button></p>-->
                  </div>
                </a>
                </div>
              </div>

            <?php } ?>         
            </div>      
        </div>

0 个答案:

没有答案