幾乎完成我最後的項目..
不知何故,畫廊滿足錯誤顯示它的圖片,我想這是因爲BASE_URL
<?php
//FOLDER GALLERY-PART
$dirname = "./assets/images/gallery/";
$images = glob($dirname."*.jpg");
array_multisort(array_map('filemtime', $images), SORT_NUMERIC, SORT_DESC, $images);
foreach($images as $image) {
echo //'<img src="'.$image.'" /><br />'; -- Ini cth untuk tampilkan semua gambar (dlm Garis lurus)
"<div class='col-xs-6 col-sm-4 col-md-3 portfolio-item logos'>
<div class='portfolio-wrapper'>
<div class='portfolio-single'>
<div class='portfolio-thumb'>
<img src='.$image.' class='img-responsive' alt=''>
</div>
<form id='imgtitle' class='kart' action='" . base_url() . "gallery/delete' method='post'>
<div class='portfolio-view'>
<ul class='nav nav-pills'>
<li><a href='#'><i class='fa fa-link'></i></a></li>
<li><a href='.$image.' data-lightbox='example-set'><i class='fa fa-eye'></i></a></li>
<li><a href='#'><i class='fa fa-heart'></i></a></li>
</ul>
</div>
</form>
</div>
<div class='portfolio-info'>
<form id='imgtitle' class='kart' action='" . base_url() . "gallery/delete' method='post'>
<input type = 'hidden' name='delete_file' value='$image' />";?>
<?php if($_SESSION['admin']==1):?>
<button type = 'submit' class='btn btn-danger'><i class='delete fa fa-trash fa-3x'></i></button>
<?php endif; ?>
<?="</form>
</div>
</div>
</div>";
}
?>
如何把BASE_URL上
$dirname
還是有其他建議?
哪裏是你的資產目錄?它是否在你的項目目錄的根目錄? –
你有沒有看過codeigniter中的html助手img()http://www.codeigniter.com/user_guide/helpers/html_helper.html#img – user4419336