簡體   English   中英

自動排序並調整為圖庫中的圖像

[英]auto sort and resize to images in the gallery

我正在一家畫廊上,我希望它可以動態排序和調整大小(以原始比例)。 在帖子的末尾,我添加了一張描述我想要的圖片。

現在,我有以下代碼,其中包含所有照片的數組,並且代碼thet應該顯示它們:

<?php
    $works = array(
        1 => array("Chill", "elenby", "http://fc03.deviantart.net/fs71/i/2014/008/f/4/chill_by_elenby-d71g75m.jpg", "http://isrart.co.il/showthread.php?t=12072"),
        2 => array("Fenix", "Elis", "http://ufu.co.il/files/aydw724j81kcd2zx3az0.jpg", "http://isrart.co.il/showthread.php?t=12070"),
        3 => array("Dont panic", "Tzah", "http://oi41.tinypic.com/vwrjly.jpg", "http://isrart.co.il/showthread.php?t=12084"),
        4 => array("Summer Jam", "elenby", "http://fc09.deviantart.net/fs70/i/2014/003/7/3/summer_jam_by_elenby-d70q8sy.jpg", "http://isrart.co.il/showthread.php?t=12052"),
        5 => array("Ancient Facts", "Dangle", "http://isrart.co.il/attachment.php?attachmentid=4173&d=1388471618", "http://isrart.co.il/showthread.php?t=12032"),
        6 => array("SAVIOR", "daskull", "http://25.media.tumblr.com/c8d55b4371ad32250129e4e1aae530b6/tumblr_mzf8alBIOe1s4jk9mo1_1280.png", "http://isrart.co.il/showthread.php?t=12106"),
        7 => array("BFF", "roni yoffe", "http://isrart.co.il/attachment.php?attachmentid=4211&d=1389791848", "http://isrart.co.il/showthread.php?t=12108"),
        8 => array("New York City", "ChananGrenblatt", "https://fbcdn-sphotos-d-a.akamaihd.net/hphotos-ak-prn1/1492578_244031302429143_693411241_o.jpg", "http://isrart.co.il/showthread.php?t=12090"),
        9 => array("Envato", "impact", "http://fc09.deviantart.net/fs71/f/2014/005/7/2/envato_by_impact_design-d70ylnm.png", "http://isrart.co.il/showthread.php?t=12068"),
        10 => array("Crismes", "Tali", "http://ufu.co.il/files/i7ehgj692t5i3m6txrv0.jpg", "http://isrart.co.il/showthread.php?t=12031")
    );
    $date = "January 2014";
?> 

<html>
    <head>
        <title><?php echo $date; ?></title>
        <meta charset="UTF-8">
        <meta name="author" content="Vlad Gincher">
        <link rel="shortcut icon" href="favicon.ico">
        <link rel="stylesheet" href="bestofthemonth.css">
    </head>
    <body>
        <div class="body">
            <img src="isrart.png" alt="Isrart" title="<?php echo $date; ?>" /><br />
            <h1><?php echo $date; ?></h1>
            <div>
                <?php
                for ($i = 1; $i < count($works); $i++){
                    echo '
                        <div id="work'.$i.'">
                            <img src="'.$works[$i][2].'" alt="" />
                        </div>
                    ';
                }
                ?>
            </div>
        </div>
    </body>
</html>

這是圖片(在代碼中,我將得到更少的圖像): 我希望它像

如在此解決方案中使用的?

演示版

講解

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM