[英]Images brought from google drive make page load very slow
I have a webpage with some images I downloaded from google drive using php code: 我有一个网页,其中包含一些使用php代码从Google驱动器下载的图像:
$albumURL = $url."host/".$fila['album']."/"; @$doc->loadHTMLFile($albumURL); $xpath = new DOMXPath($doc); $anchors = $xpath->query('//a'); $ref=""; foreach($anchors as $element) { $ref = $element->getAttribute("href"); } $first = true; foreach($anchors as $element) { $src = $element->getAttribute("href"); if($src != "http://drive.google.com"){ if($primero){ $first = false; echo '<div class="item active"><img src='.$url.$element->getAttribute("href").'></div>'."\\n"; } echo '<div class="item"><img src='.$url.$src.'></div>'."\\n"; }
The problem is that when I try to load my page it's very slow, I'm guessing that it is because of the quantity of images I request. 问题是,当我尝试加载页面时,它的运行速度非常慢,我猜这是因为我请求的图像数量大。 Here is a link of my page: http://arreglosnavidad.host22.com/arreglos.php
这是我页面的链接: http : //arreglosnavidad.host22.com/arreglos.php
I don't know if there is any way of compressing those images by using php or html/css. 我不知道是否可以通过使用php或html / css压缩这些图像。
Of course, it would be better if I don't have to upload those images in the server because of the CRUD management.(And to keep them up-to-date) 当然,由于CRUD管理,如果我不必将那些图像上传到服务器中会更好(并保持它们为最新)。
Some options 一些选择
GET
request for large quantities images hence increase client to server traffic, you can combine all several images into one big image and use relative position in your div to just display the section or subimage that is part of your consolidated image. GET
请求,从而增加客户端到服务器的通信量。 Check this link for this trick 检查此链接此技巧
https://css-tricks.com/css-sprites/ https://css-tricks.com/css-sprites/
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.