如果没有桌面替代品,如何从移动文件夹加载图像?

时间:2019-08-08 14:29:42

标签: php gallery responsive

我有一个带有图片库的网站(使用UberGallery),该网站根据用户使用的是移动/平板电脑还是台式机从两个目录之一加载图像。但是,我要加载的某些图像对于移动设备而言足够小,而对于台式机则没有更大的选择。

如果桌面目录中没有其他选择,我如何从桌面上的移动目录加载图像?

我唯一能想到的就是将同一文件复制到两个目录,但是我宁愿避免服务器上出现不必要的重复。

这是我的代码当前的样子:

elemField.setFieldName("inventoryOrganization2");

画廊的结构是这样的:

require_once "resources/Mobile_Detect.php";
$detect = new Mobile_Detect;

include_once "resources/UberGallery.php";

if ($detect->isMobile() || $detect->isTablet()) {
  // Loads smaller images optimized for mobile
  $gallery = UberGallery::init()->createGallery("gallery-images/small");
} else {
  // Loads the same images but in full-size
  $gallery = UberGallery::init()->createGallery("gallery-images");
}

如果在主gallery-images ├── small │ ├── img1.jpg │ ├── img2.jpg │ └── img3.jpg ├── img1.jpg └── img2.jpg 文件夹中没有其他选择,如何从台式机上的img3.jpg目录中加载gallery-images/small/

0 个答案:

没有答案