當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Gallery::Resize_pics方法代碼示例

本文整理匯總了PHP中Gallery::Resize_pics方法的典型用法代碼示例。如果您正苦於以下問題:PHP Gallery::Resize_pics方法的具體用法?PHP Gallery::Resize_pics怎麽用?PHP Gallery::Resize_pics使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Gallery的用法示例。


在下文中一共展示了Gallery::Resize_pics方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: build_view


//.........這裏部分代碼省略.........
                    $sort_mode = 'DESC';
                    break;
                case 'asc':
                    $sort_mode = 'ASC';
                    break;
                default:
                    $sort_mode = 'DESC';
            }
            $g_sql_sort = ' ORDER BY ' . $sort_type . ' ' . $sort_mode;
            if ($g_views) {
                $g_sql_sort = ' ORDER BY g.views DESC';
            } elseif ($g_notes) {
                $g_sql_sort = ' ORDER BY notes.average_notes DESC';
            }
            $this->tpl->put('C_GALLERY_PICS', true);
            //Affichage d'une photo demandée.
            if (!empty($g_idpics)) {
                $info_pics = $this->db_querier->select_single_row_query("SELECT g.*, m.display_name, m.groups, m.level, notes.average_notes, notes.number_notes, note.note\n\t\t\t\t\tFROM " . GallerySetup::$gallery_table . " g\n\t\t\t\t\tLEFT JOIN " . DB_TABLE_MEMBER . " m ON m.user_id = g.user_id\n\t\t\t\t\tLEFT JOIN " . DB_TABLE_COMMENTS_TOPIC . " com ON com.id_in_module = g.id AND com.module_id = 'gallery'\n\t\t\t\t\tLEFT JOIN " . DB_TABLE_AVERAGE_NOTES . " notes ON notes.id_in_module = g.id AND notes.module_name = 'gallery'\n\t\t\t\t\tLEFT JOIN " . DB_TABLE_NOTE . " note ON note.id_in_module = g.id AND note.module_name = 'gallery' AND note.user_id = :user_id\n\t\t\t\t\tWHERE g.idcat = :idcat AND g.id = :id AND g.aprob = 1\n\t\t\t\t\t" . $g_sql_sort, array('user_id' => AppContext::get_current_user()->get_id(), 'idcat' => $category->get_id(), 'id' => $g_idpics));
                if (!empty($info_pics['id'])) {
                    $Bread_crumb->add(stripslashes($info_pics['name']), PATH_TO_ROOT . '/gallery/gallery' . url('.php?cat=' . $info_pics['idcat'] . '&id=' . $info_pics['id'], '-' . $info_pics['idcat'] . '-' . $info_pics['id'] . '.php'));
                    //Affichage miniatures.
                    $id_previous = 0;
                    $id_next = 0;
                    $nbr_pics_display_before = floor(($nbr_column_pics - 1) / 2);
                    //Nombres de photos de chaque côté de la miniature de la photo affichée.
                    $nbr_pics_display_after = $nbr_column_pics - 1 - floor($nbr_pics_display_before);
                    list($i, $reach_pics_pos, $pos_pics, $thumbnails_before, $thumbnails_after, $start_thumbnails, $end_thumbnails) = array(0, false, 0, 0, 0, $nbr_pics_display_before, $nbr_pics_display_after);
                    $array_pics = array();
                    $array_js = 'var array_pics = new Array();';
                    $result = $this->db_querier->select("SELECT g.id, g.idcat, g.path\n\t\t\t\t\tFROM " . GallerySetup::$gallery_table . " g\n\t\t\t\t\tWHERE g.idcat = :idcat AND g.aprob = 1\n\t\t\t\t\t" . $g_sql_sort, array('idcat' => $category->get_id()));
                    while ($row = $result->fetch()) {
                        //Si la miniature n'existe pas (cache vidé) on regénère la miniature à partir de l'image en taille réelle.
                        if (!file_exists(PATH_TO_ROOT . '/gallery/pics/thumbnails/' . $row['path'])) {
                            $Gallery->Resize_pics(PATH_TO_ROOT . '/gallery/pics/' . $row['path']);
                        }
                        //Redimensionnement + création miniature
                        //Affichage de la liste des miniatures sous l'image.
                        $array_pics[] = '<td class="center" style="height:' . ($config->get_mini_max_height() + 16) . 'px"><span id="thumb' . $i . '"><a href="gallery' . url('.php?cat=' . $row['idcat'] . '&amp;id=' . $row['id'] . '&amp;sort=' . $g_sort, '-' . $row['idcat'] . '-' . $row['id'] . '.php?sort=' . $g_sort) . '#pics_max' . '"><img src="pics/thumbnails/' . $row['path'] . '" alt="' . $row['path'] . '" /></a></span></td>';
                        if ($row['id'] == $g_idpics) {
                            $reach_pics_pos = true;
                            $pos_pics = $i;
                        } else {
                            if (!$reach_pics_pos) {
                                $thumbnails_before++;
                                $id_previous = $row['id'];
                            } else {
                                $thumbnails_after++;
                                if (empty($id_next)) {
                                    $id_next = $row['id'];
                                }
                            }
                        }
                        $array_js .= 'array_pics[' . $i . '] = new Array();' . "\n";
                        $array_js .= 'array_pics[' . $i . '][\'link\'] = \'' . GalleryUrlBuilder::get_link_item($row['idcat'], $row['id']) . '#pics_max' . "';\n";
                        $array_js .= 'array_pics[' . $i . '][\'path\'] = \'' . $row['path'] . "';\n";
                        $i++;
                    }
                    $result->dispose();
                    $activ_note = $config->is_notation_enabled() && AppContext::get_current_user()->check_level(User::MEMBER_LEVEL);
                    if ($activ_note) {
                        //Affichage notation.
                        $notation = new Notation();
                        $notation->set_module_name('gallery');
                        $notation->set_id_in_module($info_pics['id']);
                        $notation->set_notation_scale($config->get_notation_scale());
                        $notation->set_number_notes($info_pics['number_notes']);
開發者ID:AroundPBT,項目名稱:PHPBoost,代碼行數:67,代碼來源:GalleryDisplayCategoryController.class.php

示例2: import

    $dir = 'pics/';
    import('io/upload');
    $Upload = new Upload($dir);
    $idpic = 0;
    if (is_writable($dir)) {
        if ($_FILES['gallery']['size'] > 0) {
            $Upload->file('gallery', '`([a-z0-9()_-])+\\.(jpg|gif|png)+$`i', UNIQ_NAME, $CONFIG_GALLERY['weight_max']);
            if (!empty($Upload->error)) {
                redirect(HOST . DIR . '/gallery/admin_gallery_add.php?error=' . $Upload->error . '#errorh');
            } else {
                $path = $dir . $Upload->filename['gallery'];
                $error = $Upload->validate_img($path, $CONFIG_GALLERY['width_max'], $CONFIG_GALLERY['height_max'], DELETE_ON_ERROR);
                if (!empty($error)) {
                    redirect(HOST . DIR . '/gallery/admin_gallery_add.php?error=' . $error . '#errorh');
                } else {
                    $Gallery->Resize_pics($path);
                    if (!empty($Gallery->error)) {
                        redirect(HOST . DIR . '/gallery/admin_gallery_add.php?error=' . $Gallery->error . '#errorh');
                    }
                    $name = !empty($_POST['name']) ? strprotect($_POST['name']) : '';
                    $idpic = $Gallery->Add_pics($idcat_post, $name, $Upload->filename['gallery'], $User->get_attribute('user_id'));
                    if (!empty($Gallery->error)) {
                        redirect(HOST . DIR . '/gallery/admin_gallery_add.php?error=' . $Gallery->error . '#errorh');
                    }
                    $Cache->Generate_module_file('gallery');
                }
            }
        }
    }
    redirect(HOST . DIR . '/gallery/admin_gallery_add.php?add=' . $idpic);
} elseif (!empty($_POST['valid']) && !empty($nbr_pics_post)) {
開發者ID:janus57,項目名稱:PHPBoost_v3c,代碼行數:31,代碼來源:admin_gallery_add.php

示例3: floor

 $nbr_column_pics = !empty($nbr_column_pics) ? $nbr_column_pics : 1;
 $column_width_pics = floor(100 / $nbr_column_pics);
 $Template->assign_vars(array('THEME' => get_utheme(), 'LANG' => get_ulang(), 'MODULE_DATA_PATH' => $Template->get_module_data_path('gallery'), 'PAGINATION' => $Pagination->display('admin_gallery.php?p=%d', $total_cat, 'p', $CONFIG_GALLERY['nbr_pics_max'], 3), 'COLUMN_WIDTH_CAT' => $column_width_cats, 'COLUMN_WIDTH_PICS' => $column_width_pics, 'COLSPAN' => $CONFIG_GALLERY['nbr_column'], 'CAT_ID' => $idcat, 'GALLERY' => !empty($idcat) ? $CAT_GALLERY[$idcat]['name'] : $LANG['gallery'], 'HEIGHT_MAX' => $CONFIG_GALLERY['height'] - 15, 'ADD_PICS' => '<a href="admin_gallery_add.php?cat=' . $idcat . '"><img src="../templates/' . get_utheme() . '/images/' . get_ulang() . '/add.png" alt="" class="valign_middle" /></a>', 'ARRAY_JS' => '', 'NBR_PICS' => 0, 'MAX_START' => 0, 'START_THUMB' => 0, 'END_THUMB' => 0, 'L_GALLERY_MANAGEMENT' => $LANG['gallery_management'], 'L_GALLERY_PICS_ADD' => $LANG['gallery_pics_add'], 'L_GALLERY_CAT_MANAGEMENT' => $LANG['gallery_cats_management'], 'L_GALLERY_CAT_ADD' => $LANG['gallery_cats_add'], 'L_GALLERY_CONFIG' => $LANG['gallery_config'], 'L_CONFIRM_DEL_FILE' => $LANG['confim_del_file'], 'L_FILE_FORBIDDEN_CHARS' => $LANG['file_forbidden_chars'], 'L_TOTAL_IMG' => sprintf($LANG['total_img_cat'], $nbr_pics), 'L_ADD_IMG' => $LANG['add_pic'], 'L_GALLERY' => $LANG['gallery'], 'L_CATEGORIES' => $CAT_GALLERY[$idcat]['level'] >= 0 ? $LANG['sub_album'] : $LANG['album'], 'L_NAME' => $LANG['name'], 'L_EDIT' => $LANG['edit'], 'L_MOVETO' => $LANG['moveto'], 'L_DELETE' => $LANG['delete'], 'L_SUBMIT' => $LANG['submit'], 'U_GALLERY_CAT_LINKS' => $cat_links));
 ##### Catégorie disponibles #####
 if ($total_cat > 0) {
     $Template->assign_block_vars('cat', array());
     $i = 0;
     $result = $Sql->query_while("SELECT gc.id, gc.name, gc.status, (gc.nbr_pics_aprob + gc.nbr_pics_unaprob) AS nbr_pics, gc.nbr_pics_unaprob, g.path \n\t\tFROM " . PREFIX . "gallery_cats gc\n\t\tLEFT JOIN " . PREFIX . "gallery g ON g.idcat = gc.id\n\t\t" . $clause_cat . "\n\t\tGROUP BY gc.id\n\t\tORDER BY gc.id_left\n\t\t" . $Sql->limit($Pagination->get_first_msg(10, 'p'), 10), __LINE__, __FILE__);
     while ($row = $Sql->fetch_assoc($result)) {
         $multiple_x = $i / $nbr_column_cats;
         $tr_start = is_int($multiple_x) ? '<tr>' : '';
         $i++;
         $multiple_x = $i / $nbr_column_cats;
         $tr_end = is_int($multiple_x) ? '</tr>' : '';
         if (!file_exists('pics/thumbnails/' . $row['path'])) {
             $Gallery->Resize_pics('pics/' . $row['path']);
         }
         $Template->assign_block_vars('cat.list', array('IDCAT' => $row['id'], 'CAT' => $row['name'], 'IMG' => '<img src="pics/thumbnails/' . $row['path'] . '" alt="" />', 'TR_START' => $tr_start, 'TR_END' => $tr_end, 'LOCK' => $row['status'] == 0 ? '<img class="valign_middle" src="../templates/' . get_utheme() . '/images/readonly.png" alt="" title="' . $LANG['gallery_lock'] . '" />' : '', 'L_NBR_PICS' => sprintf($LANG['nbr_pics_info_admin'], $row['nbr_pics'], $row['nbr_pics_unaprob'])));
     }
     $Sql->query_close($result);
     while (!is_int($i / $nbr_column_cats)) {
         $i++;
         $Template->assign_block_vars('cat.end_td', array('TD_END' => '<td class="row2" style="width:' . $column_width_cats . '%">&nbsp;</td>', 'TR_END' => is_int($i / $nbr_column_cats) ? '</tr>' : ''));
     }
 }
 ##### Affichage des photos #####
 if ($nbr_pics > 0) {
     $Template->assign_block_vars('pics', array('EDIT' => '<a href="admin_gallery_cat.php' . (!empty($idcat) ? '?id=' . $idcat : '') . '"><img class="valign_middle" src="../templates/' . get_utheme() . '/images/' . get_ulang() . '/edit.png" alt="" /></a>', 'PICS_MAX' => !empty($idpics) ? '<img src="show_pics.php?id=' . $idpics . '&amp;cat=' . $idcat . '" alt="" / >' : ''));
     import('util/pagination');
     $Pagination = new Pagination();
     $Template->assign_vars(array('PAGINATION_PICS' => $Pagination->display('admin_gallery.php?cat=' . $idcat . '&amp;pp=%d', $nbr_pics, 'pp', $CONFIG_GALLERY['nbr_pics_max'], 3)));
開發者ID:janus57,項目名稱:PHPBoost_v3c,代碼行數:31,代碼來源:admin_gallery.php

示例4: gallery_mini

function gallery_mini($position, $block)
{
    global $Cache, $User, $CAT_GALLERY, $CONFIG_GALLERY, $LANG, $_array_random_pics, $Sql;
    $tpl = new Template('gallery/gallery_mini.tpl');
    import('core/menu_service');
    MenuService::assign_positions_conditions($tpl, $block);
    load_module_lang('gallery');
    $Cache->load('gallery');
    $i = 0;
    $array_pics_mini = 'var array_pics_mini = new Array();' . "\n";
    list($nbr_pics, $sum_height, $sum_width, $scoll_mode, $height_max, $width_max) = array(0, 0, 0, 0, 142, 142);
    if (isset($_array_random_pics) && $_array_random_pics !== array()) {
        if (!defined('READ_CAT_GALLERY')) {
            define('READ_CAT_GALLERY', 0x1);
        }
        $gallery_mini = array();
        shuffle($_array_random_pics);
        $CAT_GALLERY[0]['auth'] = $CONFIG_GALLERY['auth_root'];
        $break = 0;
        foreach ($_array_random_pics as $array_pics_info) {
            if ($User->check_auth($CAT_GALLERY[$array_pics_info['idcat']]['auth'], READ_CAT_GALLERY)) {
                $gallery_mini[] = $array_pics_info;
                $break++;
            }
            if ($break == $CONFIG_GALLERY['nbr_pics_mini']) {
                break;
            }
        }
        if (count($gallery_mini) == 0) {
            $_array_random_pics = array();
            $result = $Sql->query_while("SELECT g.id, g.name, g.path, g.width, g.height, g.idcat, gc.auth\n    \t\tFROM " . PREFIX . "gallery g\n    \t\tLEFT JOIN " . PREFIX . "gallery_cats gc on gc.id = g.idcat\n    \t\tWHERE g.aprob = 1 AND gc.aprob = 1\n    \t\tORDER BY RAND()\n    \t\t" . $Sql->limit(0, $CONFIG_GALLERY['nbr_pics_mini']), __LINE__, __FILE__);
            while ($row = $Sql->fetch_assoc($result)) {
                $_array_random_pics[] = $row;
            }
            $break = 0;
            foreach ($_array_random_pics as $key => $array_pics_info) {
                if ($User->check_auth($CAT_GALLERY[$array_pics_info['idcat']]['auth'], READ_CAT_GALLERY)) {
                    $gallery_mini[] = $array_pics_info;
                    $break++;
                }
                if ($break == $CONFIG_GALLERY['nbr_pics_mini']) {
                    break;
                }
            }
        }
        switch ($CONFIG_GALLERY['scroll_type']) {
            case 0:
                $tpl->assign_vars(array('C_FADE' => true));
                break;
            case 1:
                $tpl->assign_vars(array('C_VERTICAL_SCROLL' => true));
                break;
            case 2:
                $tpl->assign_vars(array('C_HORIZONTAL_SCROLL' => true));
                break;
            case 3:
                $tpl->assign_vars(array('C_STATIC' => true));
                break;
        }
        include_once PATH_TO_ROOT . '/gallery/gallery.class.php';
        $Gallery = new Gallery();
        foreach ($gallery_mini as $key => $row) {
            if (!is_file(PATH_TO_ROOT . '/gallery/pics/thumbnails/' . $row['path'])) {
                $Gallery->Resize_pics(PATH_TO_ROOT . '/gallery/pics/' . $row['path']);
            }
            if ($row['width'] == 0 || $row['height'] == 0) {
                list($row['width'], $row['height']) = @getimagesize(PATH_TO_ROOT . '/gallery/pics/thumbnails/' . $row['path']);
            }
            if ($row['width'] == 0 || $row['height'] == 0) {
                list($row['width'], $row['height']) = array(142, 142);
            }
            $tpl->assign_block_vars('pics_mini', array('ID' => $i, 'PICS' => TPL_PATH_TO_ROOT . '/gallery/pics/thumbnails/' . $row['path'], 'NAME' => strprotect($row['name'], HTML_PROTECT, ADDSLASHES_FORCE), 'HEIGHT' => $row['height'], 'WIDTH' => $row['width'], 'U_PICS' => TPL_PATH_TO_ROOT . '/gallery/gallery' . url('.php?cat=' . $row['idcat'] . '&amp;id=' . $row['id'], '-' . $row['idcat'] . '-' . $row['id'] . '.php')));
            $sum_height += $row['height'] + 5;
            $sum_width += $row['width'] + 5;
            $i++;
            if ($CONFIG_GALLERY['scroll_type'] == 3) {
                break;
            }
        }
    }
    $tpl->assign_vars(array('SID' => SID, 'MODULE_DATA_PATH' => $tpl->get_module_data_path('gallery'), 'ARRAY_PICS' => $array_pics_mini, 'HEIGHT_DIV' => $CONFIG_GALLERY['height'], 'SUM_HEIGHT' => $sum_height + 10, 'HIDDEN_HEIGHT' => $CONFIG_GALLERY['height'] + 10, 'WIDTH_DIV' => $CONFIG_GALLERY['width'], 'SUM_WIDTH' => $sum_width + 30, 'HIDDEN_WIDTH' => $CONFIG_GALLERY['width'] * 3 + 30, 'SCROLL_DELAY' => 0.2 * (11 - $CONFIG_GALLERY['speed_mini_pics']), 'L_RANDOM_PICS' => $LANG['random_img'], 'L_NO_RANDOM_PICS' => $i == 0 ? '<br /><span class="text_small"><em>' . $LANG['no_random_img'] . '</em></span><br />' : '', 'L_GALLERY' => $LANG['gallery']));
    return $tpl->parse(TEMPLATE_STRING_MODE);
}
開發者ID:janus57,項目名稱:PHPBoost_v3c,代碼行數:83,代碼來源:gallery_mini.php

示例5: url

            $error = $Upload->get_error();
        }
    } else {
        $error = 'e_upload_invalid_format';
    }
    if ($error != '') {
        AppContext::get_response()->redirect(GalleryUrlBuilder::get_link_cat_add($id_category, $error) . '#message_helper');
    } else {
        $path = $dir . $Upload->get_filename();
        $error = $Upload->check_img($config->get_max_width(), $config->get_max_height(), Upload::DELETE_ON_ERROR);
        if (!empty($error)) {
            //Erreur, on arrête ici
            AppContext::get_response()->redirect(GalleryUrlBuilder::get_link_cat_add($id_category, $error) . '#message_helper');
        } else {
            //Enregistrement de l'image dans la bdd.
            $Gallery->Resize_pics($path);
            if ($Gallery->get_error() != '') {
                AppContext::get_response()->redirect(GalleryUrlBuilder::get_link_cat_add($id_category, $Upload->get_error()) . '#message_helper');
            }
            $idpic = $Gallery->Add_pics($idcat_post, $name_post, $Upload->get_filename(), AppContext::get_current_user()->get_id());
            if ($Gallery->get_error() != '') {
                AppContext::get_response()->redirect(GalleryUrlBuilder::get_link_cat_add($id_category, $Upload->get_error()) . '#message_helper');
            }
            //Régénération du cache des photos aléatoires.
            GalleryMiniMenuCache::invalidate();
        }
    }
    AppContext::get_response()->redirect(Url::to_absolute('/gallery/gallery' . url('.php?add=1&cat=' . $idcat_post . '&id=' . $idpic, '-' . $idcat_post . '-' . $idpic . '.php?add=1', '&')));
} elseif ($g_add) {
    if (AppContext::get_current_user()->is_readonly()) {
        $controller = PHPBoostErrors::user_in_read_only();
開發者ID:AroundPBT,項目名稱:PHPBoost,代碼行數:31,代碼來源:gallery.php

示例6: get_menu_content

 public function get_menu_content()
 {
     global $LANG;
     $tpl = new FileTemplate('gallery/gallery_mini.tpl');
     //Chargement de la langue du module.
     load_module_lang('gallery');
     $config = GalleryConfig::load();
     $array_random_pics = GalleryMiniMenuCache::load()->get_pictures();
     $i = 0;
     //Affichage des miniatures disponibles
     $array_pics_mini = 'var array_pics_mini = new Array();' . "\n";
     list($nbr_pics, $sum_height, $sum_width, $scoll_mode, $height_max, $width_max) = array(0, 0, 0, 0, 142, 142);
     if (isset($array_random_pics) && $array_random_pics !== array()) {
         $gallery_mini = array();
         shuffle($array_random_pics);
         //On mélange les éléments du tableau.
         //Vérification des autorisations.
         $break = 0;
         foreach ($array_random_pics as $array_pics_info) {
             if (GalleryAuthorizationsService::check_authorizations($array_pics_info['idcat'])->read()) {
                 $gallery_mini[] = $array_pics_info;
                 $break++;
             }
             if ($break == $config->get_pics_number_in_mini()) {
                 break;
             }
         }
         //Aucune photo ne correspond, on fait une requête pour vérifier.
         if (count($gallery_mini) == 0) {
             $array_random_pics = array();
             $result = PersistenceContext::get_querier()->select("SELECT g.id, g.name, g.path, g.width, g.height, g.idcat, gc.auth\n\t\t\t\tFROM " . GallerySetup::$gallery_table . " g\n\t\t\t\tLEFT JOIN " . GallerySetup::$gallery_cats_table . " gc on gc.id = g.idcat\n\t\t\t\tWHERE g.aprob = 1 AND gc.aprob = 1\n\t\t\t\tORDER BY RAND()\n\t\t\t\tLIMIT " . $config->get_pics_number_in_mini());
             while ($row = $result->fetch()) {
                 $array_random_pics[] = $row;
             }
             //Vérification des autorisations.
             $break = 0;
             foreach ($array_random_pics as $key => $array_pics_info) {
                 if (GalleryAuthorizationsService::check_authorizations($array_pics_info['idcat'])->read()) {
                     $gallery_mini[] = $array_pics_info;
                     $break++;
                 }
                 if ($break == $config->get_pics_number_in_mini()) {
                     break;
                 }
             }
         }
         $tpl->put_all(array('C_FADE' => false, 'C_VERTICAL_SCROLL' => false, 'C_HORIZONTAL_SCROLL' => false, 'C_STATIC' => false));
         switch ($config->get_scroll_type()) {
             case GalleryConfig::STATIC_SCROLL:
                 $tpl->put('C_FADE', true);
                 break;
             case GalleryConfig::VERTICAL_DYNAMIC_SCROLL:
                 $tpl->put('C_VERTICAL_SCROLL', true);
                 break;
             case GalleryConfig::HORIZONTAL_DYNAMIC_SCROLL:
                 $tpl->put('C_HORIZONTAL_SCROLL', true);
                 break;
             case GalleryConfig::NO_SCROLL:
                 $tpl->put('C_STATIC', true);
                 break;
         }
         $Gallery = new Gallery();
         foreach ($gallery_mini as $key => $row) {
             //Si la miniature n'existe pas (cache vidé) on regénère la miniature à partir de l'image en taille réelle.
             if (!is_file(PATH_TO_ROOT . '/gallery/pics/thumbnails/' . $row['path'])) {
                 $Gallery->Resize_pics(PATH_TO_ROOT . '/gallery/pics/' . $row['path']);
             }
             //Redimensionnement + création miniature
             // On recupère la hauteur et la largeur de l'image.
             if ($row['width'] == 0 || $row['height'] == 0) {
                 list($row['width'], $row['height']) = @getimagesize(PATH_TO_ROOT . '/gallery/pics/thumbnails/' . $row['path']);
             }
             if ($row['width'] == 0 || $row['height'] == 0) {
                 list($row['width'], $row['height']) = array(142, 142);
             }
             $tpl->assign_block_vars('pics_mini', array('ID' => $row['id'], 'PICS' => TPL_PATH_TO_ROOT . '/gallery/pics/thumbnails/' . $row['path'], 'NAME' => TextHelper::strprotect($row['name'], TextHelper::HTML_PROTECT, TextHelper::ADDSLASHES_FORCE), 'HEIGHT' => $row['height'], 'WIDTH' => $row['width'], 'U_PICS' => TPL_PATH_TO_ROOT . '/gallery/gallery' . url('.php?cat=' . $row['idcat'] . '&amp;id=' . $row['id'], '-' . $row['idcat'] . '-' . $row['id'] . '.php')));
             $sum_height += $row['height'] + 5;
             $sum_width += $row['width'] + 5;
             if ($config->get_scroll_type() == GalleryConfig::NO_SCROLL) {
                 break;
             }
             $i++;
         }
     }
     $tpl->put_all(array('ARRAY_PICS' => $array_pics_mini, 'HEIGHT_DIV' => $config->get_mini_max_height(), 'SUM_HEIGHT' => $sum_height + 10, 'HIDDEN_HEIGHT' => $config->get_mini_max_height() + 10, 'WIDTH_DIV' => $config->get_mini_max_width(), 'SUM_WIDTH' => $sum_width + 30, 'HIDDEN_WIDTH' => $config->get_mini_max_width() * 3 + 30, 'SCROLL_DELAY' => $config->get_mini_pics_speed() * 1000, 'L_NO_RANDOM_PICS' => $i == 0 ? '<br /><span class="smaller"><em>' . $LANG['no_random_img'] . '</em></span><br />' : '', 'L_GALLERY' => $LANG['gallery']));
     return $tpl->render();
 }
開發者ID:AroundPBT,項目名稱:PHPBoost,代碼行數:87,代碼來源:GalleryModuleMiniMenu.class.php


注:本文中的Gallery::Resize_pics方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。