即時通訊嘗試使用foreach循環與插件fotorama。foreach循環fotorama
即時消息試圖做的是加載主圖庫圖像的一半大小的圖像。我在foreach中工作,但我想使用完整的圖像數據滿標記,但我不能讓它工作。
這是工作代碼。
<div class="fotorama"
data-allowfullscreen="native"
data-nav="thumbs"
data-fit="scaledown"
data-width="100%"
data-height="100%"
data-arrows="true"
data-click="true"
data-swipe="true">
<?php
$dirname = "admin/image-upload/uploads/";
$images = glob($dirname."*.*");
foreach($images as $image) {
echo '<img src="'.$image.'" /><br />';
}
?>
</div>
這就是我試圖做的。
<div class="fotorama"
data-allowfullscreen="native"
data-nav="thumbs"
data-fit="scaledown"
data-width="100%"
data-height="100%"
data-arrows="true"
data-click="true"
data-swipe="true">
<?php
$dirname = "admin/image-upload/uploads/";
$images = glob($dirname."*.*");
$dirname2 = "admin/image-upload/full/";
$images2 = glob($dirname2."*.*");
$fullImgs = "<img data-full=".$image2." src=".$image." /><br />";
foreach($fullImgs as $fullImg) {
echo $fullImg;
}
?>
</div>
在先進的感謝球員
$ images和$ images 2都是數組,但是您只分配一次$ fullImgs的值 - 所以您的foreach只會運行一次。 –
當然,你不希望這兩件事發生在同一個地方,即使他們都工作 – RiggsFolly