其實我使用一個簡單的PHP代碼片段來遍歷一個目錄來抓取圖像並將它們插入到html標記中。從目錄加載後的PHP - 錯誤的方向
現在即時通訊面臨的問題是所有的圖像都是以橫向爲導向。所以肖像圖像也被定位爲風景圖像。
這裏是我的片斷:
<?php
$projectpath = 'Projects';
$projects = glob($projectpath . '/*' , GLOB_ONLYDIR);
foreach($projects as $key=>$value): ?>
<section class="project">
<div class="container">
<div class="row">
<div class="col-xs-12">
<div class="project-images">
<?php
$handle = opendir(dirname(realpath(__FILE__)).'/'.$value);
while($file = readdir($handle)){
if($file !== '.' && $file !== '..'){
echo '<img class="img-responsive" alt="'. $file .'" src="'. $value .'/'. $file .'"/>';
}
}
?>
</div>
</div>
</div>
</div>
</section>
<?php endforeach; ?>
那麼什麼我錯過這裏?有什麼建議麼?
你可以創建一些CSS旋轉照片90度 – Neat
嗯,如何才能css驗證方向? –
嗯,我認爲你的風景圖像的寬度值大於它們的高度值,而對於肖像圖像則是相反的方向,因此檢查哪一個較大並且如果它必須轉動或不轉動則決定。 – Neat