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


PHP Media::getFileUrl方法代码示例

本文整理汇总了PHP中Media::getFileUrl方法的典型用法代码示例。如果您正苦于以下问题:PHP Media::getFileUrl方法的具体用法?PHP Media::getFileUrl怎么用?PHP Media::getFileUrl使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Media的用法示例。


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

示例1: foreach

 foreach ($userMediaItems as $item) {
     if (!$item['private'] || $admin) {
         $baseId = "{$user['username']}-media-id-{$item['id']}";
         $jsSelectorId = CJSON::encode("#{$baseId}");
         $propertyId = addslashes($baseId);
         $desc = CHtml::encode($item['description']);
         echo '<span class="x2-pillbox media-item">';
         $path = Media::getFilePath($item['uploadedBy'], $item['fileName']);
         $filename = $item['drive'] ? $item['name'] : $item['fileName'];
         if (mb_strlen($filename, 'UTF-8') > 35) {
             $filename = mb_substr($filename, 0, 32, 'UTF-8') . '…';
         }
         echo CHtml::link($filename, array('/media', 'view' => $item['id']), array('class' => 'x2-link media media-library-item' . (Media::isImageExt($item['fileName']) ? ' image-file' : ''), 'id' => $baseId, 'data-url' => Media::model()->findByPk($item['id'])->getPublicUrl()));
         echo '</span>';
         if (Media::isImageExt($item['fileName'])) {
             $imageLink = Media::getFileUrl($path);
             $image = CHtml::image($imageLink, '', array('class' => 'media-hover-image'));
             $imageStr = CJSON::encode($image);
             if ($item['description']) {
                 $content = CJSON::encode("<span style=\"max-width: 200px;\">{$image} {$desc}</span>");
                 $imageTooltips .= "\$({$jsSelectorId}).qtip({content: {$content}, position: {my: 'top right', at: 'bottom left'}});\n";
             } else {
                 $imageTooltips .= "\$({$jsSelectorId}).qtip({content: {$imageStr}, position: {my: 'top right', at: 'bottom left'}});\n";
             }
         } else {
             if ($item['description']) {
                 $content = CJSON::encode($desc);
                 $imageTooltips .= "\$({$jsSelectorId}).qtip({content: {$content}, position: {my: 'top right', at: 'bottom left'}});\n";
             }
         }
     }
开发者ID:tymiles003,项目名称:X2CRM,代码行数:31,代码来源:mediaBox.php

示例2: MG_imageAdmin

function MG_imageAdmin($album_id, $page, $actionURL = '')
{
    global $_CONF, $_TABLES, $_USER, $_MG_CONF, $LANG_MG00, $LANG_MG01;
    $album = new mgAlbum($album_id);
    if ($actionURL == '') {
        $actionURL = $_MG_CONF['site_url'] . '/index.php';
    }
    if ($page > 0) {
        $page = $page - 1;
    }
    $begin = $_MG_CONF['mediamanage_items'] * $page;
    $end = $_MG_CONF['mediamanage_items'];
    $retval = '';
    $T = COM_newTemplate(MG_getTemplatePath($album_id));
    $T->set_file(array('admin' => 'mediamanage.thtml', 'media' => 'mediaitems.thtml'));
    // -- Get Album Cover Info..
    if ($album->access != 3) {
        COM_errorLog("Someone has tried to illegally edit media in Media Gallery. " . "User id: {$_USER['uid']}, Username: {$_USER['username']}, IP: {$REMOTE_ADDR}", 1);
        return COM_showMessageText($LANG_MG00['access_denied_msg']);
    }
    $album_cover = $album->cover;
    $album_selectbox = '<select name="album">';
    $root_album = new mgAlbum(0);
    $root_album->buildAlbumBox($album_selectbox, $album_id, 3, $album_id, 'manage');
    $album_selectbox .= '</select>';
    $sql = "SELECT * FROM {$_TABLES['mg_category']} ORDER BY cat_id ASC";
    $result = DB_query($sql);
    $nrows = DB_numRows($result);
    for ($i = 0; $i < $nrows; $i++) {
        $catRow[$i] = DB_fetchArray($result);
    }
    $sql = "SELECT COUNT(*) AS totalitems " . "FROM {$_TABLES['mg_media_albums']} " . "WHERE album_id=" . intval($album_id);
    $result = DB_query($sql);
    $row = DB_fetchArray($result);
    $totalAlbumItems = $row['totalitems'];
    $sql = MG_buildMediaSql(array('album_id' => $album_id, 'offset' => $begin, 'limit' => $end));
    $result = DB_query($sql);
    $nrows = DB_numRows($result);
    $batchOptionSelect = '<select name="batchOption">';
    if ($_CONF['image_lib'] == 'gdlib' && !function_exists("imagerotate")) {
        $batchOptionSelect .= '';
    } else {
        $batchOptionSelect .= '<option value="rrt">' . $LANG_MG01['rotate_right'] . '</option>';
        $batchOptionSelect .= '<option value="rlt">' . $LANG_MG01['rotate_left'] . '</option>';
    }
    if ($album->wm_id != 0) {
        $batchOptionSelect .= '<option value="watermark">' . $LANG_MG01['watermark'] . '</option>';
    }
    $batchOptionSelect .= '</select>&nbsp;';
    $T->set_var(array('album_id' => $album_id, 'lang_albumsel' => $LANG_MG01['destination_album'], 'albumselect' => $album_selectbox, 'lang_save' => $LANG_MG01['save'], 'lang_cancel' => $LANG_MG01['cancel'], 'lang_delete' => $LANG_MG01['delete'], 'lang_move' => $LANG_MG01['move'], 'lang_select' => $LANG_MG01['select'], 'lang_item' => $LANG_MG01['item'], 'lang_order' => $LANG_MG01['order'], 'lang_cover' => $LANG_MG01['cover'], 'lang_title' => $LANG_MG01['title'], 'lang_description' => $LANG_MG01['description'], 'lang_checkall' => $LANG_MG01['check_all'], 'lang_uncheckall' => $LANG_MG01['uncheck_all'], 'lang_rotate_right' => $LANG_MG01['rotate_right'], 'lang_rotate_left' => $LANG_MG01['rotate_left'], 'lang_batch' => $LANG_MG01['batch_process'], 'lang_media_manage_title' => $LANG_MG01['manage_media'], 'lang_media_manage_help' => $LANG_MG01['media_manage_help'], 'lang_reset_cover' => $LANG_MG01['reset_cover'], 'lang_include_ss' => $LANG_MG01['include_ss'], 'lang_watermarked' => $LANG_MG01['watermarked'], 'lang_delete_confirm' => $LANG_MG01['delete_item_confirm'], 'batchoptionselect' => $batchOptionSelect, 'lang_batch_options' => $LANG_MG01['batch_options'], 'lang_keywords' => $LANG_MG01['keywords'], 'albumselect' => $album_selectbox, 'lang_batch' => $LANG_MG01['batch_process'], 'batchoptionselect' => $batchOptionSelect, 'val_reset_cover' => $album_cover == '-1' ? ' checked="checked"' : ''));
    $tn_size = 1;
    // include:150x150
    $rowclass = 0;
    $counter = 0;
    if ($nrows == 0) {
        // we have nothing in the album at this time...
        $T->set_var('lang_no_image', $LANG_MG01['no_media_objects']);
    } else {
        $T->set_block('media', 'ImageColumn', 'IColumn');
        $T->set_block('media', 'ImageRow', 'IRow');
        for ($x = 0; $x < $nrows; $x += 3) {
            $T->set_var('IColumn', '');
            for ($j = $x; $j < $x + 3; $j++) {
                if ($j >= $nrows) {
                    break;
                }
                $row = DB_fetchArray($result);
                $album_cover_check = '';
                $radio_box = '&nbsp;';
                if (($row['media_type'] == 0 || $row['media_tn_attached'] == 1) && $album->tn_attached == 0) {
                    $checked = $album_cover == $row['media_id'] ? ' checked="checked"' : '';
                    $radio_box = '<input type="radio" name="cover" value="' . $row['media_id'] . '"' . $checked . XHTML . '>';
                    $album_cover_check = $checked;
                }
                $include_ss = '&nbsp;';
                if ($row['media_type'] == 0) {
                    $checked = $row['include_ss'] == 1 ? ' checked="checked"' : '';
                    $include_ss = '<input type="checkbox" name="ss[' . $counter . ']" value="1"' . $checked . XHTML . '>';
                }
                switch ($row['media_type']) {
                    case 0:
                        // standard image
                        list($thumbnail, $pThumbnail, $img_size) = Media::getThumbInfo($row, $tn_size);
                        $fname = $row['media_filename'];
                        $ext = $row['media_mime_ext'];
                        $pDisplay = Media::getFilePath('disp', $fname, $ext);
                        $display = Media::getFileUrl('disp', $fname, $ext);
                        break;
                    default:
                        $mediaClass = new Media($row, $album_id);
                        list($thumbnail, $pThumbnail) = $mediaClass->displayRawThumb(1);
                        $img_size = @getimagesize($pThumbnail);
                        break;
                }
                $media_time = MG_getUserDateTimeFormat($row['media_time']);
                if ($img_size != false) {
                    list($width, $height) = Media::getImageWH($img_size[0], $img_size[1], 150, 150);
                } else {
                    //$width = 100;
                    //$height = 75;
//.........这里部分代码省略.........
开发者ID:mistgrass,项目名称:geeklog-ivywe,代码行数:101,代码来源:mediamanage.php

示例3: MG_displayJPG

function MG_displayJPG($I, $opt = array())
{
    global $_CONF, $_MG_CONF, $_USER;
    $full = !empty($opt['full']) ? $opt['full'] : 0;
    $media_id = $opt['media_id'];
    $sortOrder = $opt['sortOrder'];
    $spage = $opt['spage'];
    $media_size_disp = false;
    if ($full == 1) {
        $u_image = Media::getFileUrl('orig', $I['media_filename'], $I['media_mime_ext']);
    } else {
        if ($I['remote_media'] == 1) {
            if ($I['media_resolution_x'] != 0 && $I['media_resolution_y'] != 0) {
                $media_size_disp[0] = $I['media_resolution_x'];
                $media_size_disp[1] = $I['media_resolution_y'];
            } else {
                $media_size_disp = @getimagesize($I['remote_url']);
            }
            $u_image = $I['remote_url'];
        } else {
            $u_image = Media::getFileUrl('disp', $I['media_filename'], $I['media_mime_ext']);
            $media_size_disp = @getimagesize(Media::getFilePath('disp', $I['media_filename'], $I['media_mime_ext']));
            if ($media_size_disp == false) {
                $u_image = Media::getFileUrl('disp', $I['media_filename'], 'jpg');
                $media_size_disp = @getimagesize(Media::getFilePath('disp', $I['media_filename'], 'jpg'));
                if ($media_size_disp == false) {
                    $fname = 'missing.png';
                    $u_image = $_MG_CONF['mediaobjects_url'] . '/' . $fname;
                    $p_image = $_MG_CONF['path_mediaobjects'] . $fname;
                    $media_size_disp = @getimagesize($pimage);
                }
            }
        }
    }
    if ($media_size_disp == false) {
        $media_size_disp[0] = 0;
        $media_size_disp[1] = 0;
    }
    $media_link_start = '';
    $media_link_end = '';
    $media_size_orig = @getimagesize(Media::getFilePath('orig', $I['media_filename'], $I['media_mime_ext']));
    if ($media_size_orig == false || $opt['full_display'] == 2 || $_MG_CONF['discard_original'] == 1 || $opt['full_display'] == 1 && (!isset($_USER['uid']) || $_USER['uid'] < 2)) {
        $u_pic = '#';
        $raw_link_url = '';
        if ($media_size_orig == false) {
            $media_size_orig[0] = 200;
            $media_size_orig[1] = 150;
        }
    } else {
        if ($full == 0 && $_MG_CONF['full_in_popup']) {
            $popup_x = $media_size_orig[0] + 75;
            $popup_y = $media_size_orig[1] + 100;
            $u_pic = 'javascript:showVideo(\'' . $_MG_CONF['site_url'] . '/popup.php?s=' . $media_id . '&amp;sort=' . $sortOrder . '\',' . $popup_y . ',' . $popup_x . ')';
        } else {
            $f = $full ? '0' : '1';
            if ($_MG_CONF['click_image_and_go_next']) {
                $f = $full ? '1' : '0';
            }
            $u_pic = $_MG_CONF['site_url'] . '/media.php?f=' . $f . '&amp;s=' . $media_id . '&amp;p=' . $spage;
        }
        $media_link_start = '<a href="' . $u_pic . '">';
        $media_link_end = '</a>';
        $raw_link_url = $u_pic;
    }
    $imageWidth = $full ? $media_size_orig[0] : $media_size_disp[0];
    $imageHeight = $full ? $media_size_orig[1] : $media_size_disp[1];
    $playback_type = $opt['playback_type'];
    switch ($playback_type) {
        case 0:
            // Popup Window
            $win_width = $imageWidth + 20;
            $win_height = $imageHeight + 20;
            $u_pic = Media::getHref_showvideo($I['media_id'], $win_height, $win_width);
            $raw_link_url = $u_pic;
            break;
    }
    $retval = MG_getFramedImage($opt['display_skin'], $I['media_title'], $u_pic, $u_image, $imageWidth, $imageHeight, $media_link_start, $media_link_end);
    return array($retval, $u_image, $imageWidth, $imageHeight, $raw_link_url);
}
开发者ID:mistgrass,项目名称:geeklog-ivywe,代码行数:79,代码来源:lib-media.php


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