当前位置: 首页>>代码示例>>PHP>>正文


PHP compute_img_size函数代码示例

本文整理汇总了PHP中compute_img_size函数的典型用法代码示例。如果您正苦于以下问题:PHP compute_img_size函数的具体用法?PHP compute_img_size怎么用?PHP compute_img_size使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了compute_img_size函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: cpgUserLastComment

function cpgUserLastComment($uid)
{
    global $CONFIG, $FORBIDDEN_SET;
    $result = cpg_db_query("SELECT COUNT(*), MAX(msg_id) FROM {$CONFIG['TABLE_COMMENTS']} AS c INNER JOIN {$CONFIG['TABLE_PICTURES']} AS p ON p.pid = c.pid WHERE approval = 'YES' AND author_id = '{$uid}' {$FORBIDDEN_SET}");
    list($comment_count, $lastcom_id) = mysql_fetch_row($result);
    mysql_free_result($result);
    $lastComArray = array('count' => 0);
    if ($comment_count) {
        $sql = "SELECT filepath, filename, url_prefix, pwidth, pheight, msg_author, UNIX_TIMESTAMP(msg_date) as msg_date, msg_body FROM {$CONFIG['TABLE_COMMENTS']} AS c INNER JOIN {$CONFIG['TABLE_PICTURES']} AS p ON p.pid = c.pid WHERE msg_id = {$lastcom_id}";
        $result = cpg_db_query($sql);
        if (mysql_num_rows($result)) {
            $row = mysql_fetch_assoc($result);
            $pic_url = get_pic_url($row, 'thumb');
            if (!is_image($row['filename'])) {
                $image_info = cpg_getimagesize(urldecode($pic_url));
                $row['pwidth'] = $image_info[0];
                $row['pheight'] = $image_info[1];
            }
            $image_size = compute_img_size($row['pwidth'], $row['pheight'], $CONFIG['thumb_width']);
            $lastcom = '<img src="' . $pic_url . '" class="image"' . $image_size['geom'] . ' border="0" alt="" />';
            $lastComArray = array('thumb' => $lastcom, 'comment' => $row['msg_body'], 'msg_date' => $row['msg_date'], 'count' => $comment_count);
        }
        mysql_free_result($result);
    }
    return $lastComArray;
}
开发者ID:stephenjschaefer,项目名称:APlusPhotography,代码行数:26,代码来源:profile.php

示例2: html_picture

function html_picture()
{
    global $xoopsModuleConfig, $CURRENT_PIC_DATA, $CURRENT_ALBUM_DATA, $USER, $_COOKIE;
    global $album, $comment_date_fmt;
    global $xoopsTpl, $myts;
    $pid = $CURRENT_PIC_DATA['pid'];
    if (!isset($USER['liv']) || !is_array($USER['liv'])) {
        $USER['liv'] = array();
    }
    // Add 1 to hit counter
    if ($album != "topn" && $album != "lasthits" && !in_array($pid, $USER['liv']) && isset($_COOKIE[$xoopsModuleConfig['cookie_name'] . '_data'])) {
        add_hit($pid);
        if (count($USER['liv']) > 4) {
            array_shift($USER['liv']);
        }
        array_push($USER['liv'], $pid);
    }
    if ($xoopsModuleConfig['make_intermediate'] && max($CURRENT_PIC_DATA['pwidth'], $CURRENT_PIC_DATA['pheight']) > $xoopsModuleConfig['picture_width']) {
        $picture_url = get_pic_url($CURRENT_PIC_DATA, 'normal');
    } else {
        $picture_url = get_pic_url($CURRENT_PIC_DATA, 'fullsize');
    }
    $image_size = compute_img_size($CURRENT_PIC_DATA['pwidth'], $CURRENT_PIC_DATA['pheight'], $xoopsModuleConfig['picture_width']);
    $xoopsTpl->assign('pid', $pid);
    $xoopsTpl->assign('picture_url', $picture_url);
    $xoopsTpl->assign('image_size', $image_size['geom']);
    if (is_image($CURRENT_PIC_DATA['filename'])) {
        $xoopsTpl->assign('file_type', 'image');
        if (isset($image_size['reduced'])) {
            $winsizeX = $CURRENT_PIC_DATA['pwidth'] + 16;
            $winsizeY = $CURRENT_PIC_DATA['pheight'] + 16;
            $xoopsTpl->assign('reduced', 1);
            $xoopsTpl->assign('winsizeX', $winsizeX);
            $xoopsTpl->assign('winsizeY', $winsizeY);
            $xoopsTpl->assign('uniqid_rand', uniqid(rand()));
            $xoopsTpl->assign('lang_view_fs', _MD_DIS_FULL);
        } else {
            $xoopsTpl->assign('reduced', 0);
        }
    } else {
        if (is_movie($CURRENT_PIC_DATA['filename'])) {
            $xoopsTpl->assign('file_type', 'movie');
        }
    }
    if ($CURRENT_PIC_DATA['title']) {
        $xoopsTpl->assign('pic_title', $myts->makeTboxData4Show($CURRENT_PIC_DATA['title']));
    } else {
        $xoopsTpl->assign('pic_title', '');
    }
    if ($CURRENT_PIC_DATA['caption']) {
        $xoopsTpl->assign('pic_caption', $myts->makeTareaData4Show($CURRENT_PIC_DATA['caption'], 0));
    } else {
        $xoopsTpl->assign('pic_caption', '');
    }
    if (USER_ADMIN_MODE && $CURRENT_ALBUM_DATA['category'] == FIRST_USER_CAT + USER_ID || GALLERY_ADMIN_MODE) {
        $xoopsTpl->assign('lang_confirm_del', _MD_DIS_CONF_DEL);
        $xoopsTpl->assign('lang_del_pic', _MD_DIS_DEL_PIC);
    } else {
        $xoopsTpl->assign('lang_del_pic', '');
    }
    if (!USER_CAN_SEE_FULL) {
        $xoopsTpl->assign('lang_no_full', 'Full-size images are available only for registered users!');
    } else {
        $xoopsTpl->assign('lang_no_full', '');
    }
}
开发者ID:severnaya99,项目名称:Sg-2010,代码行数:66,代码来源:displayimage.php

示例3: list_cat_albums

/**
* list_cat_albums()
*
* This has been added to list the albums in a category, used for showing first level albums, largely a repetition of code elsewhere
* Redone for a cleaner approach
* @param integer $cat Category id for which albums are needed
*/
function list_cat_albums($cat, $catdata)
{
    global $CONFIG, $lang_date, $FORBIDDEN_SET_DATA;
    global $lang_list_albums;
    $PAGE = 1;
    if ($cat == 0) {
        return '';
    }
    $cat_owner_id = $cat > 10000 ? 10000 - $cat : 10001;
    $cpg_nopic_data = cpg_get_system_thumb('nopic.jpg', $cat_owner_id);
    $cpg_privatepic_data = cpg_get_system_thumb('private.jpg', $cat_owner_id);
    $alb_per_page = $CONFIG['albums_per_page'];
    //unused code {SaWey}
    /*$maxTab = $CONFIG['max_tabs'];
    
        $album_filter = '';
        $pic_filter = '';
    
        if (!empty($FORBIDDEN_SET) && !$cpg_show_private_album) {
            $album_filter = ' and ' . str_replace('p.', 'a.', $FORBIDDEN_SET);
            $pic_filter = ' and ' . $FORBIDDEN_SET;
        }*/
    $nbAlb = $catdata['details']['alb_count'];
    if ($nbAlb == 0) {
        return;
    }
    $totalPages = ceil($nbAlb / $alb_per_page);
    $alb_list = array();
    $approved = ' AND approved=\'YES\'';
    $forbidden_set_string = count($FORBIDDEN_SET_DATA) > 0 ? ' AND aid NOT IN (' . implode(', ', $FORBIDDEN_SET_DATA) . ')' : '';
    $last_pids = array();
    $last_pid_data = array();
    foreach ($catdata['subalbums'] as $aid => $album) {
        if ($CONFIG['link_pic_count'] == 1 || $album['pic_count'] == 0) {
            if (!empty($album['keyword'])) {
                $keyword = $album['keyword'] ? "AND (keywords like '%" . addslashes($album['keyword']) . "%' {$forbidden_set_string})" : '';
                $query = "SELECT count(pid) AS link_pic_count, max(pid) AS link_last_pid, max(ctime) AS link_last_upload " . " FROM {$CONFIG['TABLE_PICTURES']} " . " WHERE ((aid != '{$aid}' {$forbidden_set_string}) {$keyword}) {$approved}";
                $result = cpg_db_query($query);
                $link_stat = $result->fetchAssoc(true);
                $catdata['subalbums'][$aid]['link_pic_count'] = $link_stat['link_pic_count'];
                $catdata['subalbums'][$aid]['last_pid'] = !empty($album['last_pid']) && $album['last_pid'] > $link_stat['link_last_pid'] ? $album['last_pid'] : $link_stat['link_last_pid'];
                if ($CONFIG['link_last_upload'] && $link_stat['link_pic_count'] > 0) {
                    $catdata['subalbums'][$aid]['last_upload'] = $album['last_upload'] > $link_stat['link_last_upload'] ? $album['last_upload'] : $link_stat['link_last_upload'];
                }
            }
        }
        if ($catdata['subalbums'][$aid]['last_pid']) {
            $last_pids[] = $catdata['subalbums'][$aid]['last_pid'];
        }
        if ($album['thumb'] > 0) {
            $last_pids[] = $album['thumb'];
        }
    }
    if (count($last_pids)) {
        $result = cpg_db_query("SELECT pid, filepath, filename, url_prefix, pwidth, pheight FROM {$CONFIG['TABLE_PICTURES']} WHERE pid IN (" . implode(',', $last_pids) . ")");
        while ($row = $result->fetchAssoc()) {
            $last_pid_data[$row['pid']] = $row;
            unset($last_pid_data[$row['pid']]['pid']);
        }
        $result->free();
    }
    unset($last_pids);
    foreach ($catdata['subalbums'] as $aid => $album) {
        // Inserts a thumbnail if the album contains 1 or more images
        //unused code {SaWey}
        //$visibility = $album['visibility'];
        $keyword = $album['keyword'] ? "OR (keywords like '%" . addslashes($album['keyword']) . "%' {$forbidden_set_string})" : '';
        if (!in_array($aid, $FORBIDDEN_SET_DATA) || $CONFIG['allow_private_albums'] == 0) {
            //test for visibility
            if ($album['pic_count'] > 0 || !empty($album['link_pic_count'])) {
                if (!empty($last_pid_data[$album['thumb']]['filename'])) {
                    $picture = $last_pid_data[$album['thumb']];
                } elseif ($album['thumb'] < 0) {
                    $sql = "SELECT filepath, filename, url_prefix, pwidth, pheight " . "FROM {$CONFIG['TABLE_PICTURES']} WHERE ((aid = '{$aid}' {$forbidden_set_string}) {$keyword}) {$approved} " . "ORDER BY RAND() LIMIT 0,1";
                    $result = cpg_db_query($sql);
                    $picture = $result->fetchAssoc(true);
                } else {
                    $picture = $last_pid_data[$album['last_pid']];
                }
                $pic_url = get_pic_url($picture, 'thumb');
                if (!is_image($picture['filename'])) {
                    $image_info = cpg_getimagesize(urldecode($pic_url));
                    $picture['pwidth'] = $image_info[0];
                    $picture['pheight'] = $image_info[1];
                }
                //thumb cropping
                if (array_key_exists('system_icon', $picture) && $picture['system_icon'] == true) {
                    $image_size = compute_img_size($picture['pwidth'], $picture['pheight'], $CONFIG['alb_list_thumb_size'], true, 'cat_thumb');
                } else {
                    $image_size = compute_img_size($picture['pwidth'], $picture['pheight'], $CONFIG['alb_list_thumb_size'], false, 'cat_thumb');
                }
                $alb_list[$aid]['thumb_pic'] = "<img src=\"" . $pic_url . "\" class=\"image thumbnail\" {$image_size['geom']} border=\"0\" alt=\"{$picture['filename']}\" />";
            } else {
//.........这里部分代码省略.........
开发者ID:CatBerg-TestOrg,项目名称:coppermine,代码行数:101,代码来源:index.php

示例4: theme_html_picture

function theme_html_picture()
{
    global $CONFIG, $CURRENT_PIC_DATA, $CURRENT_ALBUM_DATA, $USER;
    global $album, $comment_date_fmt, $template_display_media;
    global $lang_display_image_php, $lang_picinfo;
    $pid = $CURRENT_PIC_DATA['pid'];
    $pic_title = '';
    if (!isset($USER['liv']) || !is_array($USER['liv'])) {
        $USER['liv'] = array();
    }
    // Add 1 to hit counter
    if (!USER_IS_ADMIN && !in_array($pid, $USER['liv']) && isset($_COOKIE[$CONFIG['cookie_name'] . '_data'])) {
        add_hit($pid);
        if (count($USER['liv']) > 4) {
            array_shift($USER['liv']);
        }
        array_push($USER['liv'], $pid);
    }
    if ($CONFIG['thumb_use'] == 'ht' && $CURRENT_PIC_DATA['pheight'] > $CONFIG['picture_width']) {
        // The wierd comparision is because only picture_width is stored
        $condition = true;
    } elseif ($CONFIG['thumb_use'] == 'wd' && $CURRENT_PIC_DATA['pwidth'] > $CONFIG['picture_width']) {
        $condition = true;
    } elseif ($CONFIG['thumb_use'] == 'any' && max($CURRENT_PIC_DATA['pwidth'], $CURRENT_PIC_DATA['pheight']) > $CONFIG['picture_width']) {
        $condition = true;
        //thumb cropping
    } elseif ($CONFIG['thumb_use'] == 'ex' && max($CURRENT_PIC_DATA['pwidth'], $CURRENT_PIC_DATA['pheight']) > $CONFIG['picture_width']) {
        $condition = true;
    } else {
        $condition = false;
    }
    if ($CURRENT_PIC_DATA['title'] != '') {
        $pic_title .= $CURRENT_PIC_DATA['title'] . "\n";
    }
    if ($CURRENT_PIC_DATA['caption'] != '') {
        $pic_title .= $CURRENT_PIC_DATA['caption'] . "\n";
    }
    if ($CURRENT_PIC_DATA['keywords'] != '') {
        $pic_title .= $lang_picinfo['Keywords'] . ": " . $CURRENT_PIC_DATA['keywords'];
    }
    if (!$CURRENT_PIC_DATA['title'] && !$CURRENT_PIC_DATA['caption']) {
        template_extract_block($template_display_media, 'img_desc');
    } else {
        if (!$CURRENT_PIC_DATA['title']) {
            template_extract_block($template_display_media, 'title');
        }
        if (!$CURRENT_PIC_DATA['caption']) {
            template_extract_block($template_display_media, 'caption');
        }
    }
    $CURRENT_PIC_DATA['menu'] = html_picture_menu();
    //((USER_ADMIN_MODE && $CURRENT_ALBUM_DATA['category'] == FIRST_USER_CAT + USER_ID) || ($CONFIG['users_can_edit_pics'] && $CURRENT_PIC_DATA['owner_id'] == USER_ID && USER_ID != 0) || GALLERY_ADMIN_MODE) ? html_picture_menu($pid) : '';
    if ($CONFIG['make_intermediate'] && $condition) {
        $picture_url = get_pic_url($CURRENT_PIC_DATA, 'normal');
    } else {
        $picture_url = get_pic_url($CURRENT_PIC_DATA, 'fullsize');
    }
    //thumb cropping
    $image_size = compute_img_size($CURRENT_PIC_DATA['pwidth'], $CURRENT_PIC_DATA['pheight'], $CONFIG['picture_width'], 'normal');
    $pic_title = '';
    $mime_content = cpg_get_type($CURRENT_PIC_DATA['filename']);
    if ($mime_content['content'] == 'movie' || $mime_content['content'] == 'audio') {
        if ($CURRENT_PIC_DATA['pwidth'] == 0 || $CURRENT_PIC_DATA['pheight'] == 0) {
            $CURRENT_PIC_DATA['pwidth'] = 320;
            // Default width
            // Set default height; if file is a movie
            if ($mime_content['content'] == 'movie') {
                $CURRENT_PIC_DATA['pheight'] = 240;
                // Default height
            }
        }
        $ctrl_offset['mov'] = 15;
        $ctrl_offset['wmv'] = 45;
        $ctrl_offset['swf'] = 0;
        $ctrl_offset['rm'] = 0;
        $ctrl_offset_default = 45;
        $ctrl_height = isset($ctrl_offset[$mime_content['extension']]) ? $ctrl_offset[$mime_content['extension']] : $ctrl_offset_default;
        $image_size['whole'] = 'width="' . $CURRENT_PIC_DATA['pwidth'] . '" height="' . ($CURRENT_PIC_DATA['pheight'] + $ctrl_height) . '"';
    }
    if ($mime_content['content'] == 'image') {
        if (isset($image_size['reduced'])) {
            $imginfo = getimagesize($picture_url);
            $winsizeX = $CURRENT_PIC_DATA['pwidth'] + $CONFIG['fullsize_padding_x'];
            //the +'s are the mysterious FF and IE paddings
            $winsizeY = $CURRENT_PIC_DATA['pheight'] + $CONFIG['fullsize_padding_y'];
            //the +'s are the mysterious FF and IE paddings
            if ($CONFIG['transparent_overlay'] == 1) {
                $pic_html = "<table cellpadding=\"0\" cellspacing=\"0\" border=\"0\"><tr><td background=\"" . $picture_url . "\" width=\"{$imginfo[0]}\" height=\"{$imginfo[1]}\" class=\"image\">";
                $pic_html .= "<a href=\"javascript:;\" onclick=\"MM_openBrWindow('displayimage.php?pid={$pid}&amp;fullsize=1','" . uniqid(rand()) . "','scrollbars=yes,toolbar=no,status=no,resizable=yes,width={$winsizeX},height={$winsizeY}')\">";
                $pic_title = $lang_display_image_php['view_fs'] . "\n==============\n" . $pic_title;
                $pic_html .= "<img src=\"images/image.gif?id=" . floor(rand() * 1000 + rand()) . "\" width={$imginfo[0]} height={$imginfo[1]}  border=\"0\" alt=\"{$lang_display_image_php['view_fs']}\" /><br />";
                $pic_html .= "</a>\n </td></tr></table>";
            } else {
                $pic_html = "<a href=\"javascript:;\" onclick=\"MM_openBrWindow('displayimage.php?pid={$pid}&amp;fullsize=1','" . uniqid(rand()) . "','scrollbars=yes,toolbar=no,status=no,resizable=yes,width={$winsizeX},height={$winsizeY}')\">";
                $pic_title = $lang_display_image_php['view_fs'] . "\n==============\n" . $pic_title;
                $pic_html .= "<img src=\"" . $picture_url . "\" class=\"image\" border=\"0\" alt=\"{$lang_display_image_php['view_fs']}\" /><br />";
                $pic_html .= "</a>\n";
            }
        } else {
            if ($CONFIG['transparent_overlay'] == 1) {
//.........这里部分代码省略.........
开发者ID:phill104,项目名称:branches,代码行数:101,代码来源:theme.php

示例5: picrow

/**
 * picrow()
 *
 * return the HTML code for a row to be displayed for an image
 * the row contains a checkbox, the image name, a thumbnail
 *
 * @param  $picfile the full path of the file that contains the picture
 * @param  $picid the name of the check box
 * @return the HTML code
 */
function picrow($picfile, $picid, $albid)
{
    global $CONFIG, $expic_array;
    $encoded_picfile = base64_encode($picfile);
    $picname = $CONFIG['fullpath'] . $picfile;
    $pic_url = urlencode($picfile);
    $pic_fname = basename($picfile);
    $pic_dirname = dirname($picname);
    $thumb_file = dirname($picname) . '/' . $CONFIG['thumb_pfx'] . $pic_fname;
    if (file_exists($thumb_file)) {
        $thumb_info = getimagesize($picname);
        $thumb_size = compute_img_size($thumb_info[0], $thumb_info[1], 48);
        $img = '<img src="' . path2url($thumb_file) . '" ' . $thumb_size['geom'] . ' class="thumbnail" border="0" alt="" />';
    } elseif (is_image($picname)) {
        $img = '<img src="showthumb.php?picfile=' . $pic_url . '&amp;size=48" class="thumbnail" border="0" alt="" />';
    } else {
        $file['filepath'] = $pic_dirname . '/';
        //substr($picname,0,strrpos($picname,'/'))
        $file['filename'] = $pic_fname;
        $filepathname = get_pic_url($file, 'thumb');
        //$mime_content = cpg_get_type($picname);
        //$extension = file_exists("images/thumb_{$mime_content['extension']}.jpg") ? $mime_content['extension']:$mime_content['content'];
        //$img = '<img src="images/thumb_'.$extension.'.jpg" class="thumbnail" width="48" border="0" alt="" />';
        $img = '<img src="' . $filepathname . '" class="thumbnail" width="48" border="0" alt="" />';
    }
    if (filesize($picname) && is_readable($picname)) {
        //$fullimagesize = getimagesize($picname); COMMENTED OUT FOR VIDEO SUPPORT
        $winsizeX = $fullimagesize[0] + 16;
        $winsizeY = $fullimagesize[1] + 16;
        //$checked = isset($expic_array[$picfile]) || !$fullimagesize ? '' : 'checked';
        $checked = isset($expic_array[$picfile]) ? '' : 'checked';
        return <<<EOT
        <tr>
                <td class="tableb" valign="middle">
                        <input name="pics[]" id="picselector" type="checkbox" value="{$picid}" {$checked} />
                        <input name="album_lb_id_{$picid}" type="hidden" value="{$albid}" />
                        <input name="picfile_{$picid}" type="hidden" value="{$encoded_picfile}" />
                </td>
                <td class="tableb" valign="middle" width="100%">
                        <a href="javascript:;" onclick= "MM_openBrWindow('displayimage.php?fullsize=1&amp;picfile={$pic_url}', 'ImageViewer', 'toolbar=yes, status=yes, resizable=yes, width={$winsizeX}, height={$winsizeY}')">{$pic_fname}</a>
                </td>
                <td class="tableb" valign="middle" align="center">
                        <a href="javascript:;" onclick= "MM_openBrWindow('displayimage.php?fullsize=1&amp;picfile={$pic_url}', 'ImageViewer', 'toolbar=yes, status=yes, resizable=yes, width={$winsizeX}, height={$winsizeY}')"><img src="images/spacer.gif" width="1" height="48" border="0" alt="" />{$img}<br /></a>
                </td>
        </tr>
EOT;
    } else {
        $winsizeX = 300;
        $winsizeY = 300;
        return <<<EOT
        <tr>
                <td class="tableb" valign="middle">
                        &nbsp;
                </td>
                <td class="tableb" valign="middle" width="100%">
                        <i>{$pic_fname}</i>
                </td>
                <td class="tableb" valign="middle" align="center">
                        <a href="javascript:;" onclick= "MM_openBrWindow('displayimage.php?fullsize=1&amp;picfile={$pic_url}', 'ImageViewer', 'toolbar=yes, status=yes, resizable=yes, width={$winsizeX}, height={$winsizeY}')"><img src="showthumb.php?picfile={$pic_url}&amp;size=48" class="thumbnail" border="0" alt="" /><br /></a>
                </td>
        </tr>
EOT;
    }
}
开发者ID:alencarmo,项目名称:OCF,代码行数:74,代码来源:searchnew.php

示例6: display_film_strip

function display_film_strip($album, $cat, $pos)
{
    global $CONFIG, $AUTHORIZED, $HTTP_GET_VARS;
    global $album_date_fmt, $lang_display_thumbnails, $lang_errors, $lang_byte_units;
    $max_item = $CONFIG['max_film_strip_items'];
    //$thumb_per_page = $pos+$CONFIG['max_film_strip_items'];
    $thumb_per_page = $max_item * 2;
    $l_limit = max(0, $pos - $CONFIG['max_film_strip_items']);
    $new_pos = max(0, $pos - $l_limit);
    $pic_data = get_pic_data($album, $thumb_count, $album_name, $l_limit, $thumb_per_page);
    if (count($pic_data) < $max_item) {
        $max_item = count($pic_data);
    }
    $lower_limit = 3;
    if (!isset($pic_data[$new_pos + 1])) {
        $lower_limit = $new_pos - $max_item + 1;
    } else {
        if (!isset($pic_data[$new_pos + 2])) {
            $lower_limit = $new_pos - $max_item + 2;
        } else {
            if (!isset($pic_data[$new_pos - 1])) {
                $lower_limit = $new_pos;
            } else {
                $hf = $max_item / 2;
                $ihf = (int) ($max_item / 2);
                if ($new_pos > $hf) {
                    $lower_limit = $new_pos - $ihf;
                } elseif ($new_pos < $hf) {
                    $lower_limit = 0;
                }
            }
        }
    }
    $pic_data = array_slice($pic_data, $lower_limit, $max_item);
    $i = $l_limit;
    if (count($pic_data) > 0) {
        foreach ($pic_data as $key => $row) {
            $hi = $pos == $i + $lower_limit ? '1' : '';
            $i++;
            $pic_title = $lang_display_thumbnails['filename'] . $row['filename'] . "\n" . $lang_display_thumbnails['filesize'] . ($row['filesize'] >> 10) . $lang_byte_units[1] . "\n" . $lang_display_thumbnails['dimensions'] . $row['pwidth'] . "x" . $row['pheight'] . "\n" . $lang_display_thumbnails['date_added'] . localised_date($row['ctime'], $album_date_fmt);
            $pic_url = get_pic_url($row, 'thumb');
            if (!is_image($row['filename'])) {
                $image_info = getimagesize($pic_url);
                $row['pwidth'] = $image_info[0];
                $row['pheight'] = $image_info[1];
            }
            $image_size = compute_img_size($row['pwidth'], $row['pheight'], $CONFIG['thumb_width']);
            $p = $i - 1 + $lower_limit;
            $p = $p < 0 ? 0 : $p;
            $thumb_list[$i]['pos'] = $key < 0 ? $key : $p;
            $thumb_list[$i]['image'] = "<img src=\"" . $pic_url . "\" class=\"image\" {$image_size['geom']} border=\"0\" alt=\"{$row['filename']}\" title=\"{$pic_title}\">";
            $thumb_list[$i]['caption'] = $row['caption_text'];
            $thumb_list[$i]['admin_menu'] = '';
        }
        return theme_display_film_strip($thumb_list, $thumb_count, $album_name, $album, $cat, $pos, is_numeric($album));
    } else {
        theme_no_img_to_display($album_name);
    }
}
开发者ID:BackupTheBerlios,项目名称:milaninegw-svn,代码行数:59,代码来源:functions.inc.php

示例7: cpg_die

$pic_caption = $row['caption'];
if (!is_image($row['filename'])) {
    if (!is_flash($row['filename'])) {
        // The file is neither image nor flash
        if ($CONFIG['ecard_flash'] != 0) {
            cpg_die(ERROR, $lang_ecard_php['error_not_image_flash'], __FILE__, __LINE__);
        } else {
            cpg_die(ERROR, $lang_ecard_php['error_not_image'], __FILE__, __LINE__);
        }
    } elseif ($CONFIG['ecard_flash'] == 0) {
        // The file IS flash, but flash ecards are not enabled
        cpg_die(ERROR, $lang_ecard_php['error_not_image'], __FILE__, __LINE__);
    }
}
$gallery_url_prefix = $CONFIG['ecards_more_pic_target'] . (substr($CONFIG['ecards_more_pic_target'], -1) == '/' ? '' : '/');
$thumb_size = compute_img_size($row['pwidth'], $row['pheight'], $CONFIG['thumb_width']);
if (is_flash($row['filename'])) {
    $markup_picname = get_pic_url($row, 'fullsize');
    if (!stristr($markup_picname, 'http:')) {
        $markup_picname = $gallery_url_prefix . $markup_picname;
    }
    $pic_markup = <<<EOT
    <object id="SWFlash"  classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" type="application/x-shockwave-flash" width="{$thumb_size['width']}" height="{$thumb_size['height']}">
        <param name="autostart" value="true" />
        <param name="src" value="{$markup_picname}" />
    </object>
EOT;
} else {
    if (!stristr($normal_pic_url, 'http:')) {
        $normal_pic_url = $gallery_url_prefix . $normal_pic_url;
    }
开发者ID:CatBerg-TestOrg,项目名称:coppermine,代码行数:31,代码来源:ecard.php

示例8: list_cat_albums

function list_cat_albums($cat = 0)
{
    global $CONFIG, $USER, $lastup_date_fmt, $HTTP_GET_VARS, $USER_DATA, $FORBIDDEN_SET;
    global $lang_list_albums, $lang_errors, $cpg_show_private_album;
    $PAGE = 1;
    if ($cat == 0) {
        return '';
    }
    $alb_per_page = $CONFIG['albums_per_page'];
    $maxTab = $CONFIG['max_tabs'];
    $album_filter = '';
    $pic_filter = '';
    if (!empty($FORBIDDEN_SET) && !$cpg_show_private_album) {
        $album_filter = ' and ' . str_replace('p.', 'a.', $FORBIDDEN_SET);
        $pic_filter = ' and ' . $FORBIDDEN_SET;
    }
    $sql = "SELECT count(*) FROM {$CONFIG['TABLE_ALBUMS']} as a WHERE category = '{$cat}'" . $album_filter;
    $result = db_query($sql);
    $nbEnr = mysql_fetch_array($result);
    $nbAlb = $nbEnr[0];
    mysql_free_result($result);
    if ($nbAlb == 0) {
        return;
    }
    $totalPages = ceil($nbAlb / $alb_per_page);
    if ($PAGE > $totalPages) {
        $PAGE = 1;
    }
    $lower_limit = ($PAGE - 1) * $alb_per_page;
    $upper_limit = min($nbAlb, $PAGE * $alb_per_page);
    $limit = "LIMIT " . $lower_limit . "," . ($upper_limit - $lower_limit);
    /*
        $sql = "SELECT a.aid, a.title, a.description, visibility, filepath, ".
               "filename, url_prefix, pwidth, pheight ".
               "FROM {$CONFIG['TABLE_ALBUMS']} as a ".
               "LEFT JOIN {$CONFIG['TABLE_PICTURES']} as p ON thumb=pid ".
               "WHERE category = $cat ORDER BY a.pos ".$limit;
    */
    $sql = 'SELECT a.aid, a.title, a.description, visibility, filepath, ' . 'filename, url_prefix, pwidth, pheight ' . 'FROM ' . $CONFIG['TABLE_ALBUMS'] . ' as a ' . 'LEFT JOIN ' . $CONFIG['TABLE_PICTURES'] . ' as p ' . 'ON a.thumb=p.pid ' . 'WHERE category=' . $cat . $album_filter . ' ORDER BY a.pos ' . $limit;
    $alb_thumbs_q = db_query($sql);
    $alb_thumbs = db_fetch_rowset($alb_thumbs_q);
    mysql_free_result($alb_thumbs_q);
    $disp_album_count = count($alb_thumbs);
    $album_set = '';
    foreach ($alb_thumbs as $value) {
        $album_set .= $value['aid'] . ', ';
    }
    $album_set = '(' . substr($album_set, 0, -2) . ')';
    $sql = "SELECT aid, count(pid) as pic_count, max(pid) as last_pid, max(ctime) as last_upload " . "FROM {$CONFIG['TABLE_PICTURES']} " . "WHERE aid IN {$album_set} AND approved = 'YES' " . "GROUP BY aid";
    $alb_stats_q = db_query($sql);
    $alb_stats = db_fetch_rowset($alb_stats_q);
    mysql_free_result($alb_stats_q);
    foreach ($alb_stats as $key => $value) {
        $cross_ref[$value['aid']] =& $alb_stats[$key];
    }
    for ($alb_idx = 0; $alb_idx < $disp_album_count; $alb_idx++) {
        $alb_thumb =& $alb_thumbs[$alb_idx];
        $aid = $alb_thumb['aid'];
        if (isset($cross_ref[$aid])) {
            $alb_stat = $cross_ref[$aid];
            $count = $alb_stat['pic_count'];
        } else {
            $alb_stat = array();
            $count = 0;
        }
        // Inserts a thumbnail if the album contains 1 or more images
        $visibility = $alb_thumb['visibility'];
        if ($visibility == '0' || $visibility == FIRST_USER_CAT + USER_ID || in_array($visibility, $USER_DATA['groups']) || $USER_DATA['can_see_all_albums'] || $CONFIG['allow_private_albums'] == 0) {
            // test for visibility
            if ($count > 0) {
                // Inserts a thumbnail if the album contains 1 or more images
                if ($alb_thumb['filename']) {
                    $picture =& $alb_thumb;
                } else {
                    $sql = "SELECT filepath, filename, url_prefix, pwidth, pheight " . "FROM {$CONFIG['TABLE_PICTURES']} " . "WHERE pid='{$alb_stat['last_pid']}'";
                    $result = db_query($sql);
                    $picture = mysql_fetch_array($result);
                    mysql_free_result($result);
                }
                $pic_url = get_pic_url($picture, 'thumb');
                if (!is_image($picture['filename'])) {
                    $image_info = getimagesize($pic_url);
                    $picture['pwidth'] = $image_info[0];
                    $picture['pheight'] = $image_info[1];
                }
                $image_size = compute_img_size($picture['pwidth'], $picture['pheight'], $CONFIG['alb_list_thumb_size']);
                $alb_list[$alb_idx]['thumb_pic'] = "<img src=\"" . $pic_url . "\" class=\"image\" {$image_size['geom']} border=\"0\" alt=\"{$picture['filename']}\">";
            } else {
                // Inserts an empty thumbnail if the album contains 0 images
                $image_size = compute_img_size(100, 75, $CONFIG['alb_list_thumb_size']);
                $alb_list[$alb_idx]['thumb_pic'] = "<img src=\"images/nopic.jpg\" {$image_size['geom']} alt=\"\" border=\"0\" class=\"image\" />";
            }
        } elseif ($CONFIG['show_private']) {
            $image_size = compute_img_size(100, 75, $CONFIG['alb_list_thumb_size']);
            $alb_list[$alb_idx]['thumb_pic'] = "<img src=\"images/private.jpg\" {$image_size['geom']} alt=\"\" border=\"0\" class=\"image\" />";
        }
        // Prepare everything
        if ($visibility == '0' || $visibility == FIRST_USER_CAT + USER_ID || in_array($visibility, $USER_DATA['groups']) || $USER_DATA['can_see_all_albums']) {
            $last_upload_date = $count ? localised_date($alb_stat['last_upload'], $lastup_date_fmt) : '';
            $alb_list[$alb_idx]['aid'] = $alb_thumb['aid'];
//.........这里部分代码省略.........
开发者ID:BackupTheBerlios,项目名称:milaninegw-svn,代码行数:101,代码来源:index.php

示例9: slider_mainpage

function slider_mainpage()
{
    global $CONFIG, $lang_plugin_slider, $FORBIDDEN_SET, $SLIDERSET, $lang_meta_album_names, $META_ALBUM_SET, $CPG_PHP_SELF, $matches;
    // only insert stuff if we're on album list page
    require './plugins/slider/include/init.inc.php';
    require './plugins/slider/include/load_sliderset.php';
    $slider_pages_array = array('index.php');
    if (in_array($CPG_PHP_SELF, $slider_pages_array) == TRUE) {
        if ($matches[1] != 'slider') {
            return $matches;
        }
        $cpgslideplug_align = $SLIDERSET['slider_align'];
        if ($SLIDERSET['slider_autowidth']) {
            $cpgslideplug_align = "left";
        }
        echo "<!-- Start Slider PlugIn " . $lang_plugin_slider['version'] . " Table-->\n";
        $slider_icon = array('topn' => 'most_viewed', 'lastup' => 'last_uploads', 'toprated' => 'top_rated', 'random' => 'random');
        starttable("100%", cpg_fetch_icon($slider_icon[$SLIDERSET['slider_album']], 0, $lang_meta_album_names[$SLIDERSET['slider_album']]) . $lang_meta_album_names[$SLIDERSET['slider_album']]);
        ?>
        <tr>
            <td align="<?php 
        echo $cpgslideplug_align;
        ?>
">
                <table border="0" <?php 
        if ($SLIDERSET['slider_autowidth']) {
            echo "width=\"100%\" ";
        }
        ?>
 id="slidergetwidth" cellspacing="0" cellpadding="0">
                   <tr>
                       <td align="left">
<?php 
        // maximum pics to show
        $sliderlimit = $SLIDERSET['slider_numberofpics'];
        // request of your database
        $slider_pics = '';
        $slider_pics2 = '';
        $slider_pics3 = '';
        $slider_FORBIDDEN_SET = "";
        //if ($FORBIDDEN_SET != "") $slider_FORBIDDEN_SET = $FORBIDDEN_SET;
        if ($FORBIDDEN_SET != "") {
            $slider_FORBIDDEN_SET = "{$FORBIDDEN_SET}";
        }
        // request string for meta album toprated
        if ($SLIDERSET['slider_album'] == "toprated") {
            $slider_query = "SELECT * FROM {$CONFIG['TABLE_PICTURES']} AS p WHERE filename like '%.jpg' AND filename not like 'youtube_%' {$slider_FORBIDDEN_SET} AND votes >= '{$CONFIG['min_votes_for_rating']}' {$META_ALBUM_SET} ORDER BY pic_rating DESC, votes DESC, pid DESC LIMIT {$sliderlimit}";
        } else {
            if ($SLIDERSET['slider_album'] == "topn") {
                $slider_query = "SELECT * FROM {$CONFIG['TABLE_PICTURES']} AS p WHERE filename like '%.jpg' AND filename not like 'youtube_%' {$slider_FORBIDDEN_SET} AND hits > 0 {$META_ALBUM_SET} ORDER BY hits DESC, filename LIMIT {$sliderlimit}";
            } else {
                if ($SLIDERSET['slider_album'] == "lastup") {
                    $slider_query = "SELECT * FROM {$CONFIG['TABLE_PICTURES']} AS p WHERE filename like '%.jpg' AND filename not like 'youtube_%' {$slider_FORBIDDEN_SET} {$META_ALBUM_SET} ORDER BY pid DESC LIMIT {$sliderlimit}";
                } else {
                    $slider_query = "SELECT * FROM {$CONFIG['TABLE_PICTURES']} AS p WHERE filename like '%.jpg' AND filename not like 'youtube_%' {$slider_FORBIDDEN_SET} {$META_ALBUM_SET} ORDER BY RAND() LIMIT {$sliderlimit}";
                }
            }
        }
        // For reading result
        $slider_rowset = array();
        // Index of tab
        $i = 0;
        // max height : will be 75px or 100px
        $max_height = 0;
        // For each pic.....building javascript in php
        if ($SLIDERSET['slider_autowidth']) {
            $slider_minpics = 15;
        } else {
            $slider_minpics = 10;
        }
        // result of request
        $slider_result = cpg_db_query($slider_query);
        while ($slider_row = mysql_fetch_array($slider_result)) {
            if (!$SLIDERSET['slider_skipportrait'] || $slider_row['pwidth'] > $slider_row['pheight']) {
                // reading pid of pic
                $slider_key = $slider_row['pid'];
                // reading height of pic
                $slider_image_size = compute_img_size($slider_row['pwidth'], $slider_row['pheight'], $CONFIG['thumb_width']);
                // Calcul de la hauteur maxi de la zone déroulante (par défaut = 75px)
                if ($slider_image_size['height'] > $max_height) {
                    $max_height = $slider_image_size['height'];
                }
                // path of pic
                $slider_file = get_pic_url($slider_row, 'thumb');
                $slider_imgfile = get_pic_url($slider_row, $SLIDERSET['slider_pictype']);
                if ($slider_imgfile == "images/thumbs/thumb_nopic.png") {
                    $slider_imgfile = get_pic_url($slider_row, 'fullsize');
                }
                $slider_pictitle = $slider_row['title'];
                // link of pic
                if ($SLIDERSET['slider_useenlarge'] == 1) {
                    $slider_lien = "<img src=\"" . $slider_file . "\" onclick=\"enlarge(this);\" longdesc=\"" . $slider_imgfile . "\" border=\"0\" name=\"" . $slider_row['pid'] . "\" class=\"sliderimg\" alt=\"" . $slider_pictitle . "\" style=\"cursor: pointer;\" />";
                    $slider_lien2 = "<img src=\"" . $slider_file . "\" onclick=\"enlarge(this);\" longdesc=\"" . $slider_imgfile . "\" border=\"0\" name=\"" . $slider_row['pid'] . "\" class=\"sliderimg\" alt=\"" . $slider_pictitle . "\" style=\"cursor: pointer;\" />";
                    $slider_lien3 = "<img src=\"" . $slider_file . "\" onclick=\"enlarge(this);\" longdesc=\"" . $slider_imgfile . "\" border=\"0\" name=\"" . $slider_row['pid'] . "\" class=\"sliderimg\" alt=\"" . $slider_pictitle . "\" style=\"cursor: pointer;\" />";
                } else {
                    $slider_lien = "<a href=\"displayimage.php?pid={$slider_key}\"><img src=\"" . $slider_file . "\" border=\"0\" onclick=\"copyspeed=0;\" alt=\"" . $slider_pictitle . "\" /></a>";
                    $slider_lien2 = "<a href=\"displayimage.php?pid={$slider_key}\"><img src=\"" . $slider_file . "\" border=\"0\" onclick=\"copyspeed=0;\" alt=\"" . $slider_pictitle . "\" /></a>";
                    $slider_lien3 = "<a href=\"displayimage.php?pid={$slider_key}\"><img src=\"" . $slider_file . "\" border=\"0\" onclick=\"copyspeed=0;\" alt=\"" . $slider_pictitle . "\" /></a>";
                }
                // building javascript code
//.........这里部分代码省略.........
开发者ID:phill104,项目名称:branches,代码行数:101,代码来源:codebase.php

示例10: picrow

/**
 * picrow()
 *
 * return the HTML code for a row to be displayed for an image
 * the row contains a checkbox, the image name, a thumbnail
 *
 * @param $picfile the full path of the file that contains the picture
 * @param $picid the name of the check box
 * @return the HTML code
 **/
function picrow($picfile, $picid, $albid)
{
    global $xoopsModuleConfig, $expic_array;
    $encoded_picfile = base64_encode($picfile);
    $picname = XOOPS_ROOT_PATH . "/modules/xcgal/" . $xoopsModuleConfig['fullpath'] . $picfile;
    $pic_url = urlencode($picfile);
    $picpath = XOOPS_URL . "/modules/xcgal/" . $xoopsModuleConfig['fullpath'] . $picfile;
    $pic_fname = basename($picfile);
    $thumb_file = dirname($picname) . '/' . $xoopsModuleConfig['thumb_pfx'] . $pic_fname;
    if (file_exists($thumb_file)) {
        $thumb_info = getimagesize($picname);
        $thumb_size = compute_img_size($thumb_info[0], $thumb_info[1], 48);
        $img = '<img src="' . $picpath . '" ' . $thumb_size['geom'] . ' class="thumbnail" border="0">';
    } else {
        $img = '<img src="../showthumb.php?picfile=' . $pic_url . '&size=48" class="thumbnail" border="0">';
    }
    if (filesize($picname) && is_readable($picname)) {
        $fullimagesize = getimagesize($picname);
        $winsizeX = $fullimagesize[0] + 16;
        $winsizeY = $fullimagesize[1] + 16;
        $checked = isset($expic_array[$picfile]) || !$fullimagesize ? '' : 'checked="checked"';
        if ($checked == '' && $xoopsModuleConfig['batch_all'] == 0) {
            /*            return <<<EOT
                               <tr>
                                   <td class='odd' valign='middle'>
                                       <input name='pics[]' type='checkbox' value='$picid' $checked>
                                       <input name='album_lb_id_$picid' type='hidden' value="$albid">
                                       <input name="picfile_$picid" type="hidden" value="$encoded_picfile">
                                   </td>
                                   <td class="even" valign="middle" width="100%">
                                       <a href="javascript:;" onClick= "MM_openBrWindow('../displayimage.php?&fullsize=1&picfile=$pic_url', 'ImageViewer', 'toolbar=yes, status=yes, resizable=yes, width=$winsizeX, height=$winsizeY')">$pic_fname</a>
                                   </td>
                                   <td class="odd" valign="middle" align="center">
                                       <a href="javascript:;" onClick= "MM_openBrWindow('../displayimage.php?&fullsize=1&picfile=$pic_url', 'ImageViewer', 'toolbar=yes, status=yes, resizable=yes, width=$winsizeX, height=$winsizeY')">$img<br /></a>
                                   </td>
                               </tr>
            EOT;     */
        } elseif ($xoopsModuleConfig['batch_all'] == 1) {
            return <<<EOT
                   <tr>
                       <td class='odd' valign='middle'>
                           <input name='pics[]' type='checkbox' value='{$picid}' {$checked}>
                           <input name='album_lb_id_{$picid}' type='hidden' value="{$albid}">
                           <input name="picfile_{$picid}" type="hidden" value="{$encoded_picfile}">
                       </td>
                       <td class="even" valign="middle" width="100%">
                           <a href="javascript:;" onClick= "MM_openBrWindow('../displayimage.php?&fullsize=1&picfile={$pic_url}', 'ImageViewer', 'toolbar=yes, status=yes, resizable=yes, width={$winsizeX}, height={$winsizeY}')">{$pic_fname}</a>
                       </td>
                       <td class="odd" valign="middle" align="center">
                           <a href="javascript:;" onClick= "MM_openBrWindow('../displayimage.php?&fullsize=1&picfile={$pic_url}', 'ImageViewer', 'toolbar=yes, status=yes, resizable=yes, width={$winsizeX}, height={$winsizeY}')">{$img}<br /></a>
                       </td>
                   </tr>
EOT;
        }
    } else {
        $winsizeX = 300;
        $winsizeY = 300;
        return <<<EOT
        <tr>
                <td class="odd" valign="middle">
                        &nbsp;
                </td>
                <td class="even" valign="middle" width="100%">
                        <i>{$pic_fname}</i>
                </td>
                <td class="odd" valign="middle" align="center">
                        <a href="javascript:;" onClick= "MM_openBrWindow('displayimage.php?&fullsize=1&picfile={$pic_url}', 'ImageViewer', 'toolbar=yes, status=yes, resizable=yes, width={$winsizeX}, height={$winsizeY}')"><img src="showthumb.php?picfile={$pic_url}&size=48" class="thumbnail" border="0"><br /></a>
                </td>
        </tr>
EOT;
    }
}
开发者ID:severnaya99,项目名称:Sg-2010,代码行数:82,代码来源:searchnew.php

示例11: display_film_strip

/**
 * display_film_strip()
 *
 * gets data for thumbnails in an album for the film strip
 *
 * @param integer $album
 * @param integer $cat
 * @param integer $pos
 **/
function display_film_strip($album, $cat, $pos, $ajax_call)
{
    //	print $pos;
    global $CONFIG, $AUTHORIZED;
    global $album_date_fmt, $lang_display_thumbnails, $lang_errors, $lang_byte_units, $lang_common, $pic_count, $ajax_call, $pos;
    $superCage = Inspekt::makeSuperCage();
    $max_item = $CONFIG['max_film_strip_items'];
    if ($CONFIG['max_film_strip_items'] % 2 == 0) {
        $max_item = $CONFIG['max_film_strip_items'] + 1;
    }
    //print $max_item;
    $max_item_real = $max_item;
    /**check the thumb_per_page variable valid to query database*/
    if ($pic_count < $max_item_real) {
        $max_item_real = $pic_count;
    }
    //pass the max_items to the dispalyimage.js file
    set_js_var('max_item', $max_item_real);
    $max_item_to_set_width = $CONFIG['max_film_strip_items'];
    //$thumb_per_page = $pos+$CONFIG['max_film_strip_items'];
    $thumb_per_page = $max_item_real;
    //assign the varible $l_limit diffen
    $l_limit = (int) ($max_item_real / 2);
    $l_limit = max(0, $pos - $l_limit);
    //set $l_limit to last images
    if ($l_limit > $pic_count - $max_item_real) {
        $l_limit = $pic_count - $max_item_real;
    }
    $pic_data = get_pic_data($album, $thumb_count, $album_name, $l_limit, $thumb_per_page);
    if (count($pic_data) < $max_item) {
        $max_item = count($pic_data);
    }
    $lower_limit = 0;
    if ($ajax_call == 2) {
        $lower_limit = $max_item_real - 1;
        $max_item = 1;
    }
    if ($ajax_call == 1) {
        $lower_limit = 0;
        $max_item = 1;
    }
    $pic_data = array_slice($pic_data, $lower_limit, $max_item);
    $i = $l_limit;
    //set javascript count variable:: added by Nuwan Sameera Hettiarachchi
    set_js_var('count', $pic_count);
    $cat_link = is_numeric($album) ? '' : '&amp;cat=' . $cat;
    $date_link = $date == '' ? '' : '&amp;date=' . $date;
    if ($superCage->get->getInt('uid')) {
        $uid_link = '&amp;uid=' . $superCage->get->getInt('uid');
    } else {
        $uid_link = '';
    }
    if (count($pic_data) > 0) {
        foreach ($pic_data as $key => $row) {
            $hi = $pos == $i + $lower_limit ? '1' : '';
            $i++;
            $pic_title = $lang_common['filename'] . '=' . $row['filename'] . "\n" . $lang_common['filesize'] . '=' . ($row['filesize'] >> 10) . $lang_byte_units[1] . "\n" . $lang_display_thumbnails['dimensions'] . $row['pwidth'] . "x" . $row['pheight'] . "\n" . $lang_display_thumbnails['date_added'] . localised_date($row['ctime'], $album_date_fmt);
            $pic_url = get_pic_url($row, 'thumb');
            //print $pic_url;
            if (!is_image($row['filename'])) {
                $image_info = cpg_getimagesize(urldecode($pic_url));
                $row['pwidth'] = $image_info[0];
                $row['pheight'] = $image_info[1];
            }
            //thumb cropping
            if ($row['system_icon'] == 'true') {
                $image_size = compute_img_size($row['pwidth'], $row['pheight'], $CONFIG['thumb_width'], true);
            } else {
                $image_size = compute_img_size($row['pwidth'], $row['pheight'], $CONFIG['thumb_width']);
            }
            $p = $i - 1 + $lower_limit;
            $p = $p < 0 ? 0 : $p;
            $thumb_list[$i]['pos'] = $key < 0 ? $key : $p;
            $thumb_list[$i]['image'] = "<img src=\"" . $pic_url . "\" class=\"strip_image\"   border=\"0\" alt=\"{$row['filename']}\" title=\"{$pic_title}\" />";
            $thumb_list[$i]['caption'] = $CONFIG['display_film_strip_filename'] ? '<span class="thumb_filename">' . $row['filename'] . '</span>' : '';
            $thumb_list[$i]['admin_menu'] = '';
            ######### Added by Abbas #############
            $thumb_list[$i]['pid'] = $row['pid'];
            ######################################
            $target = "displayimage.php?album={$album}{$cat_link}{$date_link}&amp;pid={$row['pid']}{$uid_link}";
        }
        // Get the pos for next and prev links in filmstrip navigation
        $filmstrip_next_pos = $pos + 1;
        $filmstrip_prev_pos = $pos - 1;
        // If next pos is greater then total pics then make it pic_count - 1
        $filmstrip_next_pos = $filmstrip_next_pos >= $pic_count ? $pic_count - 1 : $filmstrip_next_pos;
        // If prev pos is less than 0 then make it 0
        $filmstrip_prev_pos = $filmstrip_prev_pos < 0 ? 0 : $filmstrip_prev_pos;
        //Using getRaw(). The date is sanitized in the called function.
        $date = $superCage->get->keyExists('date') ? cpgValidateDate($superCage->get->getRaw('date')) : null;
        if ($ajax_call == 2 || $ajax_call == 1) {
//.........这里部分代码省略.........
开发者ID:phill104,项目名称:branches,代码行数:101,代码来源:functions.inc.php

示例12: slider_mainpage

function slider_mainpage($matches)
{
    global $CONFIG, $lang_plugin_slider, $FORBIDDEN_SET, $SLIDERSET, $lang_meta_album_names, $META_ALBUM_SET;
    if ($matches[1] != 'slider') {
        return $matches;
    }
    $cpgslideplug_sliderwidth = $SLIDERSET['slider_width'] . "px";
    $cpgslideplug_sliderheight = $SLIDERSET['slider_height'] . "px";
    $cpgslideplug_slidespeed = $SLIDERSET['slider_speed'];
    $cpgslideplug_slidebgcolor = $SLIDERSET['slider_bgcolor'];
    $cpgslideplug_align = $SLIDERSET['slider_align'];
    if ($SLIDERSET['slider_autowidth']) {
        $cpgslideplug_align = "left";
    }
    echo "<!-- Start Slider PlugIn Table-->\n";
    starttable("100%", $lang_meta_album_names[$SLIDERSET['slider_album']]);
    ?>
        <tr>
            <td align="<?php 
    echo $cpgslideplug_align;
    ?>
">
                <table border="0" <?php 
    if ($SLIDERSET['slider_autowidth']) {
        echo "width=\"100%\" ";
    }
    ?>
 id="slidergetwidth" cellspacing="0" cellpadding="0">
                   <tr>
                       <td align="left">
                           <script type="text/javascript">
                                var slideshowgap=2;
                                var copyspeed=<?php 
    echo $cpgslideplug_slidespeed;
    ?>
;
                                var realcopyspeed=<?php 
    echo $cpgslideplug_slidespeed;
    ?>
;
                                var cpgslid_brwsx,cpgslid_brwsy,cpgslid_oldbrwsx,cpgslid_oldbrwsy;
<?php 
    // maximum pics to show
    $sliderlimit = $SLIDERSET['slider_numberofpics'];
    // request of your database
    $slider_pics = '';
    $slider_pics2 = '';
    $slider_pics3 = '';
    $slider_FORBIDDEN_SET = "";
    if ($FORBIDDEN_SET != "") {
        $slider_FORBIDDEN_SET = "AND {$FORBIDDEN_SET}";
    }
    // request string for meta album toprated
    if ($SLIDERSET['slider_album'] == "toprated") {
        $slider_query = "SELECT * FROM {$CONFIG['TABLE_PICTURES']} AS p WHERE filename like '%.jpg' AND filename not like 'youtube_%' approved = 'YES' {$slider_FORBIDDEN_SET} AND votes >= '{$CONFIG['min_votes_for_rating']}' {$META_ALBUM_SET} ORDER BY pic_rating DESC, votes DESC, pid DESC LIMIT {$sliderlimit}";
    } else {
        if ($SLIDERSET['slider_album'] == "topn") {
            $slider_query = "SELECT * FROM {$CONFIG['TABLE_PICTURES']} AS p WHERE filename like '%.jpg' AND filename not like 'youtube_%' AND approved = 'YES' {$slider_FORBIDDEN_SET} AND hits > 0 {$META_ALBUM_SET} ORDER BY hits DESC, filename LIMIT {$sliderlimit}";
        } else {
            if ($SLIDERSET['slider_album'] == "lastup") {
                $slider_query = "SELECT * FROM {$CONFIG['TABLE_PICTURES']} AS p WHERE filename like '%.jpg' AND filename not like 'youtube_%' AND approved = 'YES' {$slider_FORBIDDEN_SET} {$META_ALBUM_SET} ORDER BY pid DESC LIMIT {$sliderlimit}";
            } else {
                $slider_query = "SELECT * FROM {$CONFIG['TABLE_PICTURES']} AS p WHERE filename like '%.jpg' AND filename not like 'youtube_%' AND approved = 'YES' {$slider_FORBIDDEN_SET} {$META_ALBUM_SET} ORDER BY RAND() LIMIT {$sliderlimit}";
            }
        }
    }
    // For reading result
    $slider_rowset = array();
    // Index of tab
    $i = 0;
    // max height : will be 75px or 100px
    $max_height = 0;
    // For each pic.....building javascript in php
    if ($SLIDERSET['slider_autowidth']) {
        $slider_minpics = 15;
    } else {
        $slider_minpics = 10;
    }
    // result of request
    $slider_result = cpg_db_query($slider_query);
    while ($slider_row = mysql_fetch_array($slider_result)) {
        if (!$SLIDERSET['slider_skipportrait'] || $slider_row['pwidth'] > $slider_row['pheight']) {
            // reading pid of pic
            $slider_key = $slider_row['pid'];
            // reading height of pic
            $slider_image_size = compute_img_size($slider_row['pwidth'], $slider_row['pheight'], $CONFIG['thumb_width']);
            // Calcul de la hauteur maxi de la zone déroulante (par défaut = 75px)
            if ($slider_image_size['height'] > $max_height) {
                $max_height = $slider_image_size['height'];
            }
            // path of pic
            $slider_file = get_pic_url($slider_row, 'thumb');
            $slider_imgfile = get_pic_url($slider_row, $SLIDERSET['slider_pictype']);
            if (!slider_is_file($slider_imgfile)) {
                $slider_imgfile = get_pic_url($slider_row, 'fullsize');
            }
            $slider_pictitle = $slider_row['title'];
            // link of pic
            if ($SLIDERSET['slider_useenlarge'] == 1) {
                $slider_lien = "<img src=\"" . $slider_file . "\" onclick=\"enlarge(this);\" longdesc=\"" . $slider_imgfile . "\" border=\"0\" name=\"" . $slider_row['pid'] . "\" class=\"sliderimg\" alt=\"" . $slider_pictitle . "\" />";
//.........这里部分代码省略.........
开发者ID:phill104,项目名称:branches,代码行数:101,代码来源:codebase.php

示例13: cpgUserLastComment

function cpgUserLastComment($uid)
{
    global $CONFIG;
    $result = cpg_db_query("SELECT count(*), MAX(msg_id) FROM {$CONFIG['TABLE_COMMENTS']} as c, {$CONFIG['TABLE_PICTURES']} as p WHERE c.pid = p.pid AND approval='YES' AND author_id = '{$uid}' {$FORBIDDEN_SET}");
    $nbEnr = mysql_fetch_array($result);
    $comment_count = $nbEnr[0];
    $lastcom_id = $nbEnr[1];
    mysql_free_result($result);
    $lastcom = '';
    if ($comment_count) {
        $sql = "SELECT filepath, filename, url_prefix, pwidth, pheight, msg_author, UNIX_TIMESTAMP(msg_date) as msg_date, msg_body, approval " . "FROM {$CONFIG['TABLE_COMMENTS']} AS c, {$CONFIG['TABLE_PICTURES']} AS p " . "WHERE msg_id='" . $lastcom_id . "' AND approval = 'YES' AND c.pid = p.pid";
        $result = cpg_db_query($sql);
        if (mysql_num_rows($result)) {
            $row = mysql_fetch_array($result);
            mysql_free_result($result);
            $pic_url = get_pic_url($row, 'thumb');
            if (!is_image($row['filename'])) {
                $image_info = cpg_getimagesize(urldecode($pic_url));
                $row['pwidth'] = $image_info[0];
                $row['pheight'] = $image_info[1];
            }
            $image_size = compute_img_size($row['pwidth'], $row['pheight'], $CONFIG['thumb_width']);
            $mime_content = cpg_get_type($row['filename']);
            $lastcom = '<img src="' . $pic_url . '" class="image"' . $image_size['geom'] . ' border="0" alt="" />';
        }
    }
    $lastComArray = array();
    $lastComArray['thumb'] = $lastcom;
    $lastComArray['comment'] = $row['msg_body'];
    $lastComArray['msg_date'] = $row['msg_date'];
    $lastComArray['count'] = $comment_count;
    return $lastComArray;
}
开发者ID:phill104,项目名称:branches,代码行数:33,代码来源:profile.php

示例14: picrow

/**
 * picrow()
 *
 * return the HTML code for a row to be displayed for an image
 * the row contains a checkbox, the image name, a thumbnail
 *
 * @param  $picfile the full path of the file that contains the picture
 * @param  $picid the name of the check box
 * @return the HTML code
 */
function picrow($picfile, $picid, $albid)
{
    global $db, $CONFIG, $expic_array, $module_name;
    $encoded_picfile = base64_encode($picfile);
    $picname = $CONFIG['fullpath'] . $picfile;
    $pic_url = urlencode($picfile);
    $pic_fname = basename($picfile);
    $pic_dname = substr($picname, 0, -strlen($pic_fname));
    if ($CONFIG['samename'] == 1) {
        $sql = "SELECT * FROM " . $CONFIG['TABLE_PICTURES'] . " WHERE filename='" . Fix_Quotes($pic_fname) . "' AND filepath='{$pic_dname}'";
    } else {
        $sql = "SELECT * FROM " . $CONFIG['TABLE_PICTURES'] . " WHERE filename ='" . Fix_Quotes($pic_fname) . "'";
    }
    $result = $db->sql_query($sql);
    $exists = $db->sql_numrows($result);
    while ($exists <= 0) {
        $thumb_file = dirname($picname) . '/' . $CONFIG['thumb_pfx'] . $pic_fname;
        if (file_exists($thumb_file)) {
            $thumb_info = getimagesize($picname);
            $thumb_size = compute_img_size($thumb_info[0], $thumb_info[1], 48);
            $img = '<img src="' . path2url($picname) . '" ' . $thumb_size['geom'] . ' class="thumbnail" border="0" alt="" />';
        } else {
            $img = '<img src="' . URL::index($module_name . '&amp;file=showthumbbatch&amp;picfile=' . $pic_url . '&amp;size=48', 0) . '" class="thumbnail" border="0" alt="" />';
        }
        $piclink = URL::index("&file=displayimagepopup&fullsize=1&picfile={$pic_url}");
        if (filesize($picname) && is_readable($picname)) {
            $fullimagesize = getimagesize($picname);
            $winsizeX = $fullimagesize[0] + 16;
            $winsizeY = $fullimagesize[1] + 16;
            $checked = isset($expic_array[$picfile]) || !$fullimagesize ? '' : 'checked';
            return <<<EOT
\t\t<tr>
\t\t\t\t<td class="tableb" valign="middle">
\t\t\t\t\t\t<input name="pics[]" type="checkbox" value="{$picid}" {$checked} />
\t\t\t\t\t\t<input name="album_lb_id_{$picid}" type="hidden" value="{$albid}" />
\t\t\t\t\t\t<input name="picfile_{$picid}" type="hidden" value="{$encoded_picfile}" />
\t\t\t\t</td>
\t\t\t\t<td class="tableb" valign="middle" width="100%">
\t\t\t\t\t\t<a href="javascript:;" onclick= "MM_openBrWindow('{$piclink}', 'ImageViewer', 'toolbar=yes, status=yes, resizable=yes, scrollbars=yes, width={$winsizeX}, height={$winsizeY}')">{$pic_fname}</a>
\t\t\t\t</td>
\t\t\t\t<td class="tableb" valign="middle" align="center">
\t\t\t\t\t\t<a href="javascript:;" onclick= "MM_openBrWindow('{$piclink}', 'ImageViewer', 'toolbar=yes, status=yes, resizable=yes, scrollbars=yes, width={$winsizeX}, height={$winsizeY}')">{$img}<br /></a>
\t\t\t\t</td>
\t\t</tr>
EOT;
        } else {
            $winsizeX = 300;
            $winsizeY = 300;
            return <<<EOT
\t\t<tr>
\t\t\t\t<td class="tableb" valign="middle">
\t\t\t\t\t\t&nbsp;
\t\t\t\t</td>
\t\t\t\t<td class="tableb" valign="middle" width="100%">
\t\t\t\t\t\t<i>{$pic_fname}</i>
\t\t\t\t</td>
\t\t\t\t<td class="tableb" valign="middle" align="center">
\t\t\t\t\t\t<a href="javascript:;" onclick= "MM_openBrWindow('{$piclink}', 'ImageViewer', 'toolbar=yes, status=yes, resizable=yes, scrollbars=yes, width={$winsizeX}, height={$winsizeY}')"><img src="'.URL::index(&amp;file=showthumbbatch&amp;picfile={$pic_url}&amp;size=48).'" class="thumbnail" border="0" alt="" /><br /></a>
\t\t\t\t</td>
\t\t</tr>
EOT;
        }
    }
}
开发者ID:cbsistem,项目名称:nexos,代码行数:74,代码来源:searchnew.php

示例15: display_film_strip

/**
 * display_film_strip()
 *
 * gets data for thumbnails in an album for the film strip
 *
 * @param integer $album
 * @param integer $cat
 * @param integer $pos
 **/
function display_film_strip($album, $cat, $pos)
{
    global $CONFIG, $AUTHORIZED;
    global $album_date_fmt, $lang_display_thumbnails, $lang_errors, $lang_byte_units, $lang_common;
    $max_item = $CONFIG['max_film_strip_items'];
    //$thumb_per_page = $pos+$CONFIG['max_film_strip_items'];
    $thumb_per_page = $max_item * 2;
    $l_limit = max(0, $pos - $CONFIG['max_film_strip_items']);
    $new_pos = max(0, $pos - $l_limit);
    $pic_data = get_pic_data($album, $thumb_count, $album_name, $l_limit, $thumb_per_page);
    if (count($pic_data) < $max_item) {
        $max_item = count($pic_data);
    }
    $lower_limit = 3;
    if (!isset($pic_data[$new_pos + 1])) {
        $lower_limit = $new_pos - $max_item + 1;
    } else {
        if (!isset($pic_data[$new_pos + 2])) {
            $lower_limit = $new_pos - $max_item + 2;
        } else {
            if (!isset($pic_data[$new_pos - 1])) {
                $lower_limit = $new_pos;
            } else {
                $hf = $max_item / 2;
                $ihf = (int) ($max_item / 2);
                if ($new_pos > $hf) {
                    $lower_limit = $new_pos - $ihf;
                } elseif ($new_pos <= $hf) {
                    $lower_limit = 0;
                }
            }
        }
    }
    $pic_data = array_slice($pic_data, $lower_limit, $max_item);
    $i = $l_limit;
    if (count($pic_data) > 0) {
        foreach ($pic_data as $key => $row) {
            $hi = $pos == $i + $lower_limit ? '1' : '';
            $i++;
            $pic_title = $lang_common['filename'] . '=' . $row['filename'] . "\n" . $lang_common['filesize'] . '=' . ($row['filesize'] >> 10) . $lang_byte_units[1] . "\n" . $lang_display_thumbnails['dimensions'] . $row['pwidth'] . "x" . $row['pheight'] . "\n" . $lang_display_thumbnails['date_added'] . localised_date($row['ctime'], $album_date_fmt);
            $pic_url = get_pic_url($row, 'thumb');
            if (!is_image($row['filename'])) {
                $image_info = getimagesize(urldecode($pic_url));
                $row['pwidth'] = $image_info[0];
                $row['pheight'] = $image_info[1];
            }
            //thumb cropping
            if ($row['system_icon'] == 'true') {
                $image_size = compute_img_size($row['pwidth'], $row['pheight'], $CONFIG['thumb_width'], true);
            } else {
                $image_size = compute_img_size($row['pwidth'], $row['pheight'], $CONFIG['thumb_width']);
            }
            $p = $i - 1 + $lower_limit;
            $p = $p < 0 ? 0 : $p;
            $thumb_list[$i]['pos'] = $key < 0 ? $key : $p;
            $thumb_list[$i]['image'] = "<img src=\"" . $pic_url . "\" class=\"image\" {$image_size['geom']} border=\"0\" alt=\"{$row['filename']}\" title=\"{$pic_title}\" />";
            $thumb_list[$i]['caption'] = $CONFIG['display_film_strip_filename'] ? '<span class="thumb_filename">' . $row['filename'] . '</span>' : '';
            $thumb_list[$i]['admin_menu'] = '';
            ######### Added by Abbas #############
            $thumb_list[$i]['pid'] = $row['pid'];
            ######################################
        }
        $date = isset($_GET['date']) ? cpgValidateDate($_GET['date']) : null;
        return theme_display_film_strip($thumb_list, $thumb_count, $album_name, $album, $cat, $pos, is_numeric($album), 'thumb', $date);
    } else {
        theme_no_img_to_display($album_name);
    }
}
开发者ID:phill104,项目名称:branches,代码行数:77,代码来源:functions.inc.php


注:本文中的compute_img_size函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。