• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP path2url函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: enl_main


//.........这里部分代码省略.........
                $album = $row['aid'];
                $pic_data = get_pic_data($album, $pic_count, $album_name, -1, -1, false);
                for ($pos = 0; $pic_data[$pos]['pid'] != $pid && $pos < $pic_count; $pos++) {
                }
                $pic_data = get_pic_data($album, $pic_count, $album_name, $pos, 1, false);
                $CURRENT_PIC_DATA = $pic_data[0];
            } else {
                $pic_data = get_pic_data($album, $pic_count, $album_name, $pos, 1, false);
                if (count($pic_data) == 0 && $pos >= $pic_count) {
                    $pos = $pic_count - 1;
                    $human_pos = $pos + 1;
                    $pic_data = get_pic_data($album, $pic_count, $album_name, $pos, 1, false);
                }
                $CURRENT_PIC_DATA = $pic_data[0];
            }
            if (!$ENLARGEITSET['enl_sefmode']) {
                $neu_str = '<a onclick="return false;" href="displayimage.php?' . $match[1];
            } else {
                $neu_str = '<a onclick="return false;" href="displayimage-' . $match[1] . '.html';
            }
            if ($ENLARGEITSET['enl_pictype'] == 1) {
                $enl_path = $CONFIG['fullpath'] . $CURRENT_PIC_DATA['filepath'] . $CURRENT_PIC_DATA['filename'];
            } else {
                if ($ENLARGEITSET['enl_pictype'] == 2) {
                    $enl_path = $CONFIG['fullpath'] . $CURRENT_PIC_DATA['filepath'] . $CONFIG['normal_pfx'] . $CURRENT_PIC_DATA['filename'];
                } else {
                    if ($ENLARGEITSET['enl_pictype'] == 0 && is_file($CONFIG['fullpath'] . $CURRENT_PIC_DATA['filepath'] . $CONFIG['normal_pfx'] . $CURRENT_PIC_DATA['filename'])) {
                        $enl_path = $CONFIG['fullpath'] . $CURRENT_PIC_DATA['filepath'] . $CONFIG['normal_pfx'] . $CURRENT_PIC_DATA['filename'];
                    } else {
                        $enl_path = $CONFIG['fullpath'] . $CURRENT_PIC_DATA['filepath'] . $CURRENT_PIC_DATA['filename'];
                    }
                }
            }
            if ($enl_filetyplower == 'swf') {
                $enl_swfheight = $CURRENT_PIC_DATA['pheight'];
                $enl_swfwidth = $CURRENT_PIC_DATA['pwidth'];
                if ($enl_swfheight == 0) {
                    $enl_swfheight = 400;
                }
                if ($enl_swfwidth == 0) {
                    $enl_swfwidth = 400;
                }
                $neu_str .= '"><img src="' . $match[2] . $CONFIG['thumb_pfx'] . $match[3] . '" longdesc="swf::' . path2url($enl_path) . '::' . $enl_swfwidth . '::' . $enl_swfheight;
            } else {
                if ($enl_filetyplower == 'ytb') {
                    $neu_str .= '"><img src="' . $match[2] . $CONFIG['thumb_pfx'] . $match[3] . '" longdesc="swf::' . str_replace(".jpg", "", str_replace("youtube_", "http://www.youtube.com/v/", $CURRENT_PIC_DATA['filename'])) . '&amp;fs=1&amp;rel=0::480::385';
                } else {
                    if ($enl_filetyplower == 'dvx') {
                        $enl_dvxheight = $CURRENT_PIC_DATA['pheight'] + 20;
                        $enl_dvxwidth = $CURRENT_PIC_DATA['pwidth'];
                        if ($enl_dvxheight == 20) {
                            $enl_dvxheight = 212;
                        }
                        if ($enl_dvxwidth == 0) {
                            $enl_dvxwidth = 320;
                        }
                        $neu_str .= '"><img src="' . $match[2] . $CONFIG['thumb_pfx'] . $match[3] . '" longdesc="dvx::' . path2url($enl_path) . '::' . $enl_dvxwidth . '::' . $enl_dvxheight;
                    } else {
                        if ($enl_filetyplower == 'flv') {
                            $enl_flvheight = $CURRENT_PIC_DATA['pheight'];
                            $enl_flvwidth = $CURRENT_PIC_DATA['pwidth'];
                            if ($enl_flvheight == 0) {
                                $enl_flvheight = 410;
                            }
                            if ($enl_flvwidth == 0) {
                                $enl_flvwidth = 500;
                            }
                            if ($ENLARGEITSET['enl_flvplayer'] == 1) {
                                $neu_str .= '"><img src="' . $match[2] . $CONFIG['thumb_pfx'] . $match[3] . '" longdesc="fl2::../../../' . path2url($enl_path) . '::' . $enl_flvwidth . '::' . $enl_flvheight;
                            } else {
                                $neu_str .= '"><img src="' . $match[2] . $CONFIG['thumb_pfx'] . $match[3] . '" longdesc="flv::../../../' . path2url($enl_path) . '::' . $enl_flvwidth . '::' . $enl_flvheight;
                            }
                        } else {
                            $neu_str .= '"><img src="' . $CONFIG['fullpath'] . path2url($CURRENT_PIC_DATA['filepath'] . $CONFIG['thumb_pfx'] . $CURRENT_PIC_DATA['filename']) . '" longdesc="' . path2url($enl_path);
                        }
                    }
                }
            }
            // build the rest of the string depending on thumb_use setting
            switch ($CONFIG['thumb_use']) {
                case "ht":
                    $neu_str .= '" border="0" height="' . $match[4] . '" name="' . $CURRENT_PIC_DATA['pid'] . '" class="enlargeimg" onclick="enlarge(this);" alt="' . $CURRENT_PIC_DATA['title'] . '" title="" /><br /></a>';
                    break;
                case "wd":
                    $neu_str .= '" border="0" width="' . $match[4] . '" name="' . $CURRENT_PIC_DATA['pid'] . '" class="enlargeimg" onclick="enlarge(this);" alt="' . $CURRENT_PIC_DATA['title'] . '" title="" /><br /></a>';
                    break;
                default:
                    $neu_str .= '" border="0" width="' . $match[4] . '" height="' . $match[5] . '" name="' . $CURRENT_PIC_DATA['pid'] . '" class="enlargeimg" onclick="enlarge(this);" alt="' . $CURRENT_PIC_DATA['title'] . '" title="" /><br /></a>';
                    break;
            }
            if ($CURRENT_PIC_DATA['pid'] == $_GET['enlarge']) {
                $html = str_replace("enl_gifpath = 'plugins/enlargeit/js/'", "enl_openpic = \"enl" . $i . "\";enl_gifpath = 'plugins/enlargeit/js/'", $html);
            }
            //$neu_str .= "<script type=\"text/javascript\">enl_openpic = \"enl".$i."\";</script>";
            // replace
            $html = str_replace($match[0], $neu_str, $html);
        }
    }
    return $html;
}
开发者ID:phill104,项目名称:branches,代码行数:101,代码来源:codebase.php


示例2: array


//.........这里部分代码省略.........
    $mime_content = cpg_get_type($pic_row['filename']);
    $pic_row = array_merge($pic_row, $mime_content);
    $filepathname = null;
    // Code to handle custom thumbnails
    // If fullsize or normal mode use regular file
    if ($mime_content['content'] != 'image' && $mode == 'normal') {
        $mode = 'fullsize';
    } elseif ($mime_content['content'] != 'image' && $mode == 'thumb' || $system_pic) {
        $thumb_extensions = array('.gif', '.png', '.jpg');
        // Check for user-level custom thumbnails
        // Create custom thumb path and erase extension using filename; Erase filename's extension
        $custom_thumb_path = $url_prefix[$pic_row['url_prefix']] . $pic_row['filepath'] . $pic_prefix[$mode];
        $file_base_name = str_replace('.' . $mime_content['extension'], '', basename($pic_row['filename']));
        // Check for file-specific thumbs
        foreach ($thumb_extensions as $extension) {
            if (file_exists($custom_thumb_path . $file_base_name . $extension)) {
                $filepathname = $custom_thumb_path . $file_base_name . $extension;
                break;
            }
        }
        if (!$system_pic) {
            // Check for extension-specific thumbs
            if (is_null($filepathname)) {
                foreach ($thumb_extensions as $extension) {
                    if (file_exists($custom_thumb_path . $mime_content['extension'] . $extension)) {
                        $filepathname = $custom_thumb_path . $mime_content['extension'] . $extension;
                        break;
                    }
                }
            }
            // Check for content-specific thumbs
            if (is_null($filepathname)) {
                foreach ($thumb_extensions as $extension) {
                    if (file_exists($custom_thumb_path . $mime_content['content'] . $extension)) {
                        $filepathname = $custom_thumb_path . $mime_content['content'] . $extension;
                        break;
                    }
                }
            }
        }
        // Use default thumbs
        if (is_null($filepathname)) {
            // Check for default theme- and global-level thumbs
            $thumb_paths[] = $THEME_DIR . 'images/';
            // Used for custom theme thumbs
            $thumb_paths[] = 'images/';
            // Default Coppermine thumbs
            foreach ($thumb_paths as $default_thumb_path) {
                if (is_dir($default_thumb_path)) {
                    if (!$system_pic) {
                        foreach ($thumb_extensions as $extension) {
                            // Check for extension-specific thumbs
                            if (file_exists($default_thumb_path . $CONFIG['thumb_pfx'] . $mime_content['extension'] . $extension)) {
                                $filepathname = $default_thumb_path . $CONFIG['thumb_pfx'] . $mime_content['extension'] . $extension;
                                //thumb cropping - if we display a system thumb we calculate the dimension by any and not ex
                                $pic_row['system_icon'] = true;
                                break 2;
                            }
                        }
                        foreach ($thumb_extensions as $extension) {
                            // Check for media-specific thumbs (movie,document,audio)
                            if (file_exists($default_thumb_path . $CONFIG['thumb_pfx'] . $mime_content['content'] . $extension)) {
                                $filepathname = $default_thumb_path . $CONFIG['thumb_pfx'] . $mime_content['content'] . $extension;
                                //thumb cropping
                                $pic_row['system_icon'] = true;
                                break 2;
                            }
                        }
                    } else {
                        // Check for file-specific thumbs for system files
                        foreach ($thumb_extensions as $extension) {
                            if (file_exists($default_thumb_path . $CONFIG['thumb_pfx'] . $file_base_name . $extension)) {
                                $filepathname = $default_thumb_path . $CONFIG['thumb_pfx'] . $file_base_name . $extension;
                                //thumb cropping
                                $pic_row['system_icon'] = true;
                                break 2;
                            }
                        }
                    }
                }
            }
        }
        $filepathname = path2url($filepathname);
    }
    if (is_null($filepathname)) {
        $filepathname = $url_prefix[$pic_row['url_prefix']] . path2url($pic_row['filepath'] . $pic_prefix[$mode] . $pic_row['filename']);
    }
    // Added hack:  "&& !isset($pic_row['mode'])" thumb_data filter isn't executed for the fullsize image
    if ($mode == 'thumb' && !isset($pic_row['mode'])) {
        $pic_row['url'] = $filepathname;
        $pic_row['mode'] = $mode;
        $pic_row = CPGPluginAPI::filter('thumb_data', $pic_row);
    } elseif ($mode != 'thumb') {
        $pic_row['url'] = $filepathname;
        $pic_row['mode'] = $mode;
    } else {
        $pic_row['url'] = $filepathname;
    }
    return $pic_row['url'];
}
开发者ID:phill104,项目名称:branches,代码行数:101,代码来源:functions.inc.php


示例3: path2url

<?php

function path2url($file, $Protocol = 'http://')
{
    $docRoot = str_replace('/', '\\', $_SERVER['DOCUMENT_ROOT']);
    return $Protocol . $_SERVER['HTTP_HOST'] . str_replace($docRoot, '', $file);
}
$dir = __DIR__ . '/gallery';
$files = scandir($dir);
$gallery = [];
foreach ($files as $file) {
    $path = $dir . '/' . $file;
    $fileType = filetype($path);
    if ($fileType === 'file') {
        $gallery[] = ["alt" => $file, "extension" => pathinfo($path, PATHINFO_EXTENSION), "thumbnailUrl" => path2url($dir) . '/thumbnails/' . $file, "title" => $file, "type" => filetype($path), "url" => path2url($path)];
    }
}
echo json_encode($gallery);
开发者ID:automizy,项目名称:automizy-email-editor,代码行数:18,代码来源:gallery.php


示例4: array


//.........这里部分代码省略.........
        if (!$system_pic) {
            // Check for extension-specific thumbs
            if (is_null($filepathname)) {
                foreach ($thumb_extensions as $extension) {
                    if (file_exists($custom_thumb_path . $mime_content['extension'] . $extension)) {
                        $filepathname = $custom_thumb_path . $mime_content['extension'] . $extension;
                        break;
                    }
                }
            }
            // Check for content-specific thumbs
            if (is_null($filepathname)) {
                foreach ($thumb_extensions as $extension) {
                    if (file_exists($custom_thumb_path . $mime_content['content'] . $extension)) {
                        $filepathname = $custom_thumb_path . $mime_content['content'] . $extension;
                        break;
                    }
                }
            }
        }
        // Use default thumbs
        if (is_null($filepathname)) {
            // Check for default theme- and global-level thumbs
            $thumb_paths[] = $THEME_DIR . 'images/';
            // Used for custom theme thumbs
            $thumb_paths[] = 'images/thumbs/';
            // Default Coppermine thumbs
            foreach ($thumb_paths as $default_thumb_path) {
                if (is_dir($default_thumb_path)) {
                    if (!$system_pic) {
                        foreach ($thumb_extensions as $extension) {
                            // Check for extension-specific thumbs
                            if (file_exists($default_thumb_path . $CONFIG['thumb_pfx'] . $mime_content['extension'] . $extension)) {
                                $filepathname = $default_thumb_path . $CONFIG['thumb_pfx'] . $mime_content['extension'] . $extension;
                                //thumb cropping - if we display a system thumb we calculate the dimension by any and not ex
                                $pic_row['system_icon'] = true;
                                break 2;
                            }
                        }
                        foreach ($thumb_extensions as $extension) {
                            // Check for media-specific thumbs (movie,document,audio)
                            if (file_exists($default_thumb_path . $CONFIG['thumb_pfx'] . $mime_content['content'] . $extension)) {
                                $filepathname = $default_thumb_path . $CONFIG['thumb_pfx'] . $mime_content['content'] . $extension;
                                //thumb cropping
                                $pic_row['system_icon'] = true;
                                break 2;
                            }
                        }
                    } else {
                        // Check for file-specific thumbs for system files
                        foreach ($thumb_extensions as $extension) {
                            if (file_exists($default_thumb_path . $CONFIG['thumb_pfx'] . $file_base_name . $extension)) {
                                $filepathname = $default_thumb_path . $CONFIG['thumb_pfx'] . $file_base_name . $extension;
                                //thumb cropping
                                $pic_row['system_icon'] = true;
                                break 2;
                            }
                        }
                        // foreach $thumb_extensions
                    }
                    // else $system_pic
                }
                // if is_dir($default_thumb_path)
            }
            // foreach $thumbpaths
        }
        // if is_null($filepathname)
        if ($filepathname) {
            $filepathname = path2url($filepathname);
        }
    }
    if (is_null($filepathname)) {
        $localpath = $pic_row['filepath'] . $pic_prefix[$mode] . $pic_row['filename'];
        // Check here that the filename we are going to return exists
        // If it doesn't exist we return a placeholder image
        // We then log the missing file for the admin's attention
        if (file_exists($url_prefix[$pic_row['url_prefix']] . $localpath)) {
            $filepathname = $url_prefix[$pic_row['url_prefix']] . path2url($localpath);
        } else {
            $filepathname = 'images/thumbs/thumb_nopic.png';
            $pic_row['system_icon'] = true;
            if ($CONFIG['log_mode'] != 0) {
                log_write("File {$url_prefix[$pic_row['url_prefix']]}{$localpath} is missing.");
            }
        }
    }
    // Added hack:  "&& !isset($pic_row['mode'])" thumb_data filter isn't executed for the fullsize image
    if ($mode == 'thumb' && !isset($pic_row['mode'])) {
        $pic_row['url'] = $filepathname;
        $pic_row['mode'] = $mode;
        $pic_row = CPGPluginAPI::filter('thumb_data', $pic_row);
    } elseif ($mode != 'thumb') {
        $pic_row['url'] = $filepathname;
        $pic_row['mode'] = $mode;
    } else {
        $pic_row['url'] = $filepathname;
    }
    $pic_row = CPGPluginAPI::filter('picture_url', $pic_row);
    return $pic_row['url'];
}
开发者ID:stephenjschaefer,项目名称:APlusPhotography,代码行数:101,代码来源:functions.inc.php


示例5: get_pic_url

function get_pic_url(&$pic_row, $mode)
{
    global $CONFIG, $THEME_DIR;
    static $pic_prefix = array();
    static $url_prefix = array();
    if (!count($pic_prefix)) {
        $pic_prefix = array('thumb' => $CONFIG['thumb_pfx'], 'normal' => $CONFIG['normal_pfx'], 'fullsize' => '');
        $url_prefix = array(0 => $CONFIG['fullpath']);
    }
    $mime_content = get_type($pic_row['filename']);
    $filepathname = null;
    // Code to handle custom thumbnails
    // If fullsize or normal mode use regular file
    if ($mime_content['content'] != 'image' && $mode != 'thumb') {
        $mode = 'fullsize';
    } elseif ($mime_content['content'] != 'image' && $mode == 'thumb') {
        $thumb_extensions = array('.gif', '.png', '.jpg');
        // Check for user-level custom thumbnails
        // Create custom thumb path and erase extension using filename; Erase filename's extension
        $custom_thumb_path = $url_prefix[$pic_row['url_prefix']] . $pic_row['filepath'] . $pic_prefix[$mode];
        $file_base_name = str_replace('.' . $mime_content['extension'], '', basename($pic_row['filename']));
        // Check for file-specific thumbs
        foreach ($thumb_extensions as $extension) {
            if (file_exists($custom_thumb_path . $file_base_name . $extension)) {
                $filepathname = $custom_thumb_path . $file_base_name . $extension;
                break;
            }
        }
        // Check for extension-specific thumbs
        if (is_null($filepathname)) {
            foreach ($thumb_extensions as $extension) {
                if (file_exists($custom_thumb_path . $mime_content['extension'] . $extension)) {
                    $filepathname = $custom_thumb_path . $mime_content['extension'] . $extension;
                    break;
                }
            }
        }
        // Check for content-specific thumbs
        if (is_null($filepathname)) {
            foreach ($thumb_extensions as $extension) {
                if (file_exists($custom_thumb_path . $mime_content['content'] . $extension)) {
                    $filepathname = $custom_thumb_path . $mime_content['content'] . $extension;
                    break;
                }
            }
        }
        // Use default thumbs
        if (is_null($filepathname)) {
            // Check for default theme- and global-level thumbs
            $thumb_paths[] = $THEME_DIR . '/images/';
            // Used for custom theme thumbs
            $thumb_paths[] = 'images/';
            // Default Coppermine thumbs
            foreach ($thumb_paths as $default_thumb_path) {
                if (is_dir($default_thumb_path)) {
                    foreach ($thumb_extensions as $extension) {
                        // Check for extension-specific thumbs
                        if (file_exists($default_thumb_path . $CONFIG['thumb_pfx'] . $mime_content['extension'] . $extension)) {
                            $filepathname = $default_thumb_path . $CONFIG['thumb_pfx'] . $mime_content['extension'] . $extension;
                            break 2;
                        }
                    }
                    foreach ($thumb_extensions as $extension) {
                        // Check for media-specific thumbs (movie,document,audio)
                        if (file_exists($default_thumb_path . $CONFIG['thumb_pfx'] . $mime_content['content'] . $extension)) {
                            $filepathname = $default_thumb_path . $CONFIG['thumb_pfx'] . $mime_content['content'] . $extension;
                            break 2;
                        }
                    }
                }
            }
        }
        return path2url($filepathname);
    }
    return $url_prefix[$pic_row['url_prefix']] . path2url($pic_row['filepath'] . $pic_prefix[$mode] . $pic_row['filename']);
}
开发者ID:BackupTheBerlios,项目名称:milaninegw-svn,代码行数:76,代码来源:functions.inc.php


示例6: 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


示例7: path2url

        } else {
            echo path2url($mergedFile);
            @unlink($video);
            @unlink($audio);
        }
    } else {
        echo "Problem writing video file to disk!";
    }
} else {
    if (isset($_FILES["audio-blob"])) {
        $audio = getcwd() . '/uploads/' . $_POST["audio-filename"];
        if (move_uploaded_file($_FILES["audio-blob"]["tmp_name"], $audio)) {
            echo path2url($audio);
        } else {
            echo "Problem writing video file to disk!";
        }
    } else {
        if (isset($_FILES["video-blob"])) {
            $video = getcwd() . '/uploads/' . $_POST["video-filename"];
            if (move_uploaded_file($_FILES["video-blob"]["tmp_name"], $video)) {
                echo path2url($video);
            } else {
                echo "Problem writing video file to disk!";
            }
        }
    }
}
function path2url($file, $Protocol = 'http://')
{
    return $Protocol . str_replace(str_replace("\\", '/', $_SERVER['DOCUMENT_ROOT']), $_SERVER['HTTP_HOST'] . '/', str_replace("\\", '/', $file));
}
开发者ID:greyzero,项目名称:expertcamjs,代码行数:31,代码来源:save.php


示例8: 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, $picrowCounter;
    $encoded_picfile = urlencode(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 ($CONFIG['display_thumbs_batch_add'] == 1) {
        if (file_exists($thumb_file)) {
            $thumb_info = cpg_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 . '/';
            $file['filename'] = $pic_fname;
            $filepathname = get_pic_url($file, 'thumb');
            $img = '<img src="' . $filepathname . '" class="thumbnail" width="48" border="0" alt="" />';
        }
    } else {
        $img = '';
    }
    if (filesize($picname) && is_readable($picname)) {
        // for video support, maybe check: http://www.getid3.org/
        // for now, hack in something that works (don't check !$fullimagesize)
        $fullimagesize = cpg_getimagesize($picname);
        $winsizeX = $fullimagesize[0] + 16;
        $winsizeY = $fullimagesize[1] + 16;
        // $checked = isset($expic_array[$picfile]) || !$fullimagesize ? '' : 'checked';
        $picfile_replaced_forbidden = dirname($picfile) . '/' . replace_forbidden(basename($picfile));
        if ($CONFIG['batch_add_hide_existing_files'] && isset($expic_array[$picfile_replaced_forbidden])) {
            return;
        }
        if ($picrowCounter++ % 2) {
            $rowStyle = 'tableb';
        } else {
            $rowStyle = 'tableb tableb_alternate';
        }
        $checked = isset($expic_array[$picfile_replaced_forbidden]) || !is_known_filetype($pic_fname) ? '' : 'checked="checked"';
        $return = <<<EOT
        <tr>
                <td class="{$rowStyle}" valign="middle" width="30">
                        <input name="pics[]" id="checkbox_p_{$picid}" 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>
EOT;
        // if $fullimagesize is not null, then assume it's an image
        if ($fullimagesize) {
            $return .= <<<EOT
                <td class="{$rowStyle}" valign="middle">
                        <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="{$rowStyle}" 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}')">
EOT;
        } else {
            // assume it's not an image so hope that browser can display/play it with a helper app
            $nonpic_url = rawurldecode($pic_url);
            $return .= <<<EOT
                <td class="{$rowStyle}" valign="middle">
                        <a href="javascript:;" onclick= "MM_openBrWindow('{$CONFIG['fullpath']}{$nonpic_url}', 'ImageViewer', 'toolbar=yes, status=yes, resizable=yes, width={$winsizeX}, height={$winsizeY}')">{$pic_fname}</a>
                </td>
                <td class="{$rowStyle}" valign="middle" align="center">
                        <a href="javascript:;" onclick= "MM_openBrWindow('{$CONFIG['fullpath']}{$nonpic_url}', 'ImageViewer', 'toolbar=yes, status=yes, resizable=yes, width={$winsizeX}, height={$winsizeY}')">
EOT;
        }
        if ($CONFIG['display_thumbs_batch_add'] == 1) {
            $return .= <<<EOT
                        <img src="images/spacer.gif" width="1" height="48" border="0" alt="" />
EOT;
        }
        $return .= <<<EOT
                        {$img}</a><br />
                </td>

                <td class="{$rowStyle}" valign="middle" width="100" height="40">
                    <p id="p_{$picid}" name="addpic.php?pic_file={$encoded_picfile}"></p>
                </td>
        </tr>
EOT;
        return $return;
    } else {
        $winsizeX = 300;
        $winsizeY = 300;
        $return = <<<EOT
        <tr>
//.........这里部分代码省略.........
开发者ID:CatBerg-TestOrg,项目名称:coppermine,代码行数:101,代码来源:searchnew.php


示例9: enlargeit_addparams

function enlargeit_addparams($params)
{
    global $thumb, $CONFIG, $template_thumbnail_view, $CURRENT_PIC_DATA, $enlargeit_supported_image_file_array, $enlargeit_supported_video_file_array;
    // enabled for current user type?
    if (GALLERY_ADMIN_MODE && !$CONFIG['plugin_enlargeit_adminmode']) {
        return $params;
    }
    if (USER_ID && !$CONFIG['plugin_enlargeit_registeredmode']) {
        return $params;
    }
    if (!USER_ID && !$CONFIG['plugin_enlargeit_guestmode']) {
        return $params;
    }
    // Populate the list of files that this plugin should be used with in the first place
    $image_array = explode('/', $CONFIG['plugin_enlargeit_img_types']);
    $movie_array = explode('/', $CONFIG['plugin_enlargeit_mov_types']);
    $enl_filetyplower = strtolower(ltrim(substr($thumb['filename'], strrpos($thumb['filename'], '.')), '.'));
    if (substr($thumb['filename'], 0, 8) == 'youtube_') {
        $enl_filetyplower = 'ytb';
    }
    // get file path depending if normal size pic exists and config setting enl_pictype
    if ($CONFIG['plugin_enlargeit_pictype'] == '1') {
        $enl_path = $CONFIG['fullpath'] . $thumb['filepath'] . $thumb['filename'];
    } elseif ($CONFIG['plugin_enlargeit_pictype'] == '2') {
        $enl_path = $CONFIG['fullpath'] . $thumb['filepath'] . $CONFIG['normal_pfx'] . $thumb['filename'];
    } elseif ($CONFIG['plugin_enlargeit_pictype'] == '0' && is_file($CONFIG['fullpath'] . $thumb['filepath'] . $CONFIG['normal_pfx'] . $thumb['filename'])) {
        $enl_path = $CONFIG['fullpath'] . $thumb['filepath'] . $CONFIG['normal_pfx'] . $thumb['filename'];
    } else {
        $enl_path = $CONFIG['fullpath'] . $thumb['filepath'] . $thumb['filename'];
    }
    // CASE 1: images
    if (in_array($enl_filetyplower, $image_array) == TRUE) {
        $enl_newthumb = '<img src="' . $CONFIG['fullpath'] . $thumb['filepath'] . $CONFIG['thumb_pfx'] . $thumb['filename'] . '" ';
        $enl_newthumb .= 'class="enlargeimg" ';
        if ($CONFIG['thumb_use'] == 'any' && $thumb['pwidth'] >= $thumb['pheight'] || $CONFIG['thumb_use'] == 'wd') {
            $enl_thumbheight = round($thumb['pheight'] / $thumb['pwidth'] * $CONFIG['thumb_width']);
            $enl_newthumb .= 'width="' . $CONFIG['thumb_width'] . '" height="' . $enl_thumbheight . '" ';
        } elseif ($CONFIG['thumb_use'] == 'any' && $thumb['pwidth'] < $thumb['pheight'] || $CONFIG['thumb_use'] == 'ht') {
            $enl_thumbwidth = round($thumb['pwidth'] / $thumb['pheight'] * $CONFIG['thumb_width']);
            $enl_newthumb .= 'width="' . $enl_thumbwidth . '" height="' . $CONFIG['thumb_width'] . '" ';
        }
        $enl_newthumb .= 'border="0" onclick="enlarge(this);" longdesc="' . path2url($enl_path) . '" name="' . $thumb['pid'] . '" ';
        $enl_newthumb .= 'alt="' . $thumb['title'] . '" />';
        $more_params = array('{LINK_ONCLICK}' => 'onclick="return false;"', '{THUMB}' => $enl_newthumb);
    } elseif (in_array($enl_filetyplower, $movie_array) == TRUE) {
        $pid = $thumb['pid'];
        // For flash or movie files we need some more data from the database
        $result = cpg_db_query("SELECT aid from {$CONFIG['TABLE_PICTURES']} WHERE pid='{$pid}' LIMIT 1");
        $row = mysql_fetch_array($result);
        $album = $row['aid'];
        $pic_data = get_pic_data($album, $pic_count, $album_name, -1, -1, false);
        for ($pos = 0; $pic_data[$pos]['pid'] != $pid && $pos < $pic_count; $pos++) {
            $pic_data = get_pic_data($album, $pic_count, $album_name, $pos, 1, false);
        }
        $CURRENT_PIC_DATA = $pic_data[0];
        if ($CURRENT_PIC_DATA['pwidth'] == 0) {
            $CURRENT_PIC_DATA['pwidth'] = 500;
        }
        if ($CURRENT_PIC_DATA['pheight'] == 0) {
            $CURRENT_PIC_DATA['pheight'] = 410;
        }
        if ($enl_filetyplower == 'swf') {
            $enl_newthumb = '<img src="images/thumbs/thumb_swf.png" class="enlargeimg" width="' . $thumb['pwidth'] . '" height="' . $thumb['pheight'] . '" ';
        } else {
            $enl_newthumb = '<img src="images/thumbs/thumb_movie.png" class="enlargeimg" width="' . $thumb['pwidth'] . '" height="' . $thumb['pheight'] . '" ';
        }
        $enl_newthumb .= 'border="0" onclick="enlarge(this);" ';
        if ($enl_filetyplower == 'swf') {
            $enl_newthumb .= 'longdesc="swf::' . path2url($enl_path) . '::' . $CURRENT_PIC_DATA['pwidth'] . '::' . $CURRENT_PIC_DATA['pheight'] . '" ';
        } elseif ($enl_filetyplower == 'flv') {
            if ($CONFIG['plugin_enlargeit_flvplayer'] == '0') {
                $enl_newthumb .= 'longdesc="fl2::../../../../' . path2url($enl_path) . '::' . $CURRENT_PIC_DATA['pwidth'] . '::' . $CURRENT_PIC_DATA['pheight'] . '" ';
            } else {
                $enl_newthumb .= 'longdesc="flv::../../../../' . path2url($enl_path) . '::' . $CURRENT_PIC_DATA['pwidth'] . '::' . $CURRENT_PIC_DATA['pheight'] . '" ';
            }
        } elseif ($enl_filetyplower == 'dvx') {
            $enl_newthumb .= 'longdesc="dvx::' . path2url($enl_path) . '::' . $CURRENT_PIC_DATA['pwidth'] . '::' . $CURRENT_PIC_DATA['pheight'] . '" ';
        }
        $enl_newthumb .= 'name="' . $thumb['pid'] . '" alt="" title="' . $thumb['title'] . '" />';
        $more_params = array('{LINK_ONCLICK}' => 'onclick="return false;"', '{THUMB}' => $enl_newthumb);
    } else {
        $more_params = array('{LINK_ONCLICK}' => '');
    }
    return array_merge($params, $more_params);
}
开发者ID:phill104,项目名称:branches,代码行数:85,代码来源:codebase.php


示例10: path2url

                    echo '<p>File Updated</p>';
                }
            } else {
                if ($numAliases > 0) {
                    echo '<p>The Alias: ' . $alias->getAlias() . ' already exists</p>';
                } else {
                    if ($alias->getAlias() == "/") {
                        echo '<p>Alias cannot be saved as /</p>';
                        //shouldnt occur
                    } else {
                        echo '<p>Couldnt save...</p>';
                    }
                }
            }
        }
        $fileUploadPath = path2url(str_replace('//', '/', DIRECTORY_SEPARATOR . UPLOAD_FOLDER_NAME . DIRECTORY_SEPARATOR . $uploadTo . issetOrBlank($_FILES["file-file"]['name'])));
        //$fileUploadPath = str_replace('//','/',$fileUploadPath);
        echo '<p>File Link: <a href="' . $fileUploadPath . '" target="_blank">' . issetOrBlank($_FILES["file-file"]['name']) . '</a></p>';
        echo '<textarea style="width: 100%;"><a href="' . $fileUploadPath . '" target="_blank">' . issetOrBlank($_FILES["file-file"]['name']) . '</a></textarea>';
    }
    exit;
    ?>
	</body>
	</html>
	<?php 
}
?>
<html>
<head>
	<title>File Upload</title>
	<link rel="stylesheet" href="//code.jquery.com/ui/1.11.4/themes/cupertino/jquery-ui.css" />
开发者ID:bren1818,项目名称:fileupload,代码行数:31,代码来源:addFile.php


示例11: imagecreatefrompng

    if ($ext === 'png') {
        $source_image = imagecreatefrompng($src);
    } else {
        $source_image = imagecreatefromjpeg($src);
    }
    $width = imagesx($source_image);
    $height = imagesy($source_image);
    $desired_height = floor($height * ($desired_width / $width));
    $virtual_image = imagecreatetruecolor($desired_width, $desired_height);
    if ($ext === 'png') {
        imagecolortransparent($virtual_image, imagecolorallocate($virtual_image, 0, 0, 0));
        imagealphablending($virtual_image, false);
        imagesavealpha($virtual_image, true);
    }
    imagecopyresampled($virtual_image, $source_image, 0, 0, 0, 0, $desired_width, $desired_height, $width, $height);
    if ($ext === 'png') {
        imagepng($virtual_image, $dest);
    } else {
        imagejpeg($virtual_image, $dest);
    }
}
$target_dir = __DIR__ . "/gallery";
$thumbnail_dir = $target_dir . "/thumbnails";
$file = $_FILES["upload_file"];
$target_file = $target_dir . '/' . basename($file["name"]);
$imageFileType = pathinfo($target_file, PATHINFO_EXTENSION);
if (in_array($imageFileType, ['jpg', 'jpeg', 'png', 'gif'], false)) {
    move_uploaded_file($file["tmp_name"], $target_file);
    make_thumb($target_file, $thumbnail_dir . '/' . basename($file["name"]), 300);
    echo json_encode([$file["name"] => ["url" => path2url($target_dir . '/' . $file["name"])]]);
}
开发者ID:automizy,项目名称:automizy-email-editor,代码行数:31,代码来源:upload.php


示例12: anis_display_fullsize_pic

function anis_display_fullsize_pic()
{
    global $CONFIG, $THEME_DIR, $ALBUM_SET;
    global $lang_errors, $lang_fullsize_popup, $lang_charset;
    $superCage = Inspekt::makeSuperCage();
    if ($superCage->get->keyExists('picfile')) {
        if (!GALLERY_ADMIN_MODE) {
            cpg_die(ERROR, $lang_errors['access_denied'], __FILE__, __LINE__);
        }
        $picfile = $superCage->get->getRaw('picfile');
        $picname = $CONFIG['fullpath'] . $picfile;
        $imagesize = @getimagesize($picname);
        $imagedata = array('name' => $picfile, 'path' => path2url($picname), 'geometry' => $imagesize[3]);
    } elseif ($superCage->get->keyExists('pid')) {
        $pid = $superCage->get->getInt('pid');
        $sql = "SELECT * " . "FROM {$CONFIG['TABLE_PICTURES']} " . "WHERE pid='{$pid}' {$ALBUM_SET}";
        $result = cpg_db_query($sql);
        if (!mysql_num_rows($result)) {
            cpg_die(ERROR, $lang_errors['non_exist_ap'], __FILE__, __LINE__);
        }
        $row = mysql_fetch_array($result);
        $pic_url = get_pic_url($row, 'fullsize');
        $geom = 'width="' . $row['pwidth'] . '" height="' . $row['pheight'] . '"';
        $imagedata = array('name' => $row['filename'], 'path' => $pic_url, 'geometry' => $geom);
    }
    ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
  <head>
  <title><?php 
    echo $CONFIG['gallery_name'];
    ?>
: <?php 
    echo $lang_fullsize_popup['click_to_close'];
    ?>
</title>
  <meta http-equiv="content-type" content="text/html; charset=<?php 
    echo $CONFIG['charset'] == 'language file' ? $lang_charset : $CONFIG['charset'];
    ?>
" />
  <script type="text/javascript">
  function adjust_popup()
{
        var w, h, fixedW, fixedH, diffW, diffH;
        if (document.documentElement && document.body.clientHeight==0) {     // Catches IE6 and FF in DOCMODE
                fixedW = document.documentElement.clientWidth;
                fixedH = document.documentElement.clientHeight;
                window.resizeTo(fixedW, fixedH);
                diffW = fixedW - document.documentElement.clientWidth;
                diffH = fixedH - document.documentElement.clientHeight;
                w = fixedW + diffW + 16; // Vert Scrollbar Always On in DOCMODE.
                h = fixedH + diffH;
                if (w >= screen.availWidth) h += 16;
        } else if (document.all) {
                fixedW = document.body.clientWidth;
                fixedH = document.body.clientHeight;
                window.resizeTo(fixedW, fixedH);
                diffW = fixedW - document.body.clientWidth;
                diffH = fixedH - document.body.clientHeight;
                w = fixedW + diffW;
                h = fixedH + diffH;
                if (h >= screen.availHeight) w += 16;
                if (w >= screen.availWidth)  h += 16;
        } else {
                fixedW = window.innerWidth;
                fixedH = window.innerHeight;
                window.resizeTo(fixedW, fixedH);
                diffW = fixedW - window.innerWidth;
                diffH = fixedH - window.innerHeight;
                w = fixedW + diffW;
                h = fixedH + diffH;
                if (w >= screen.availWidth)  h += 16;
                if (h >= screen.availHeight) w += 16;
        }
        w = Math.min(w,screen.availWidth);
        h = Math.min(h,screen.availHeight);
        paspect = <?php 
    echo $row['pwidth'] / $row['pheight'];
    ?>
; // Picture aspect ratio
        caspect = w/h; // Current aspect ratio
        if (paspect > caspect) {
            h = Math.round(h / paspect * caspect); // Adjust height
        }
        if (paspect < caspect) {
            w = Math.round(w / caspect * paspect); // Adjust width
        }
        window.resizeTo(w,h);
        window.moveTo((screen.availWidth-w)/2, (screen.availHeight-h)/2);
       // alert('<!-- width: ' + w + ' height: ' + h + ' --> ');
       //applet_tag='<APPLET codebase=\"plugins/CPGAnis/anis\" code=\"AniS.class\&quo 

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP pathID函数代码示例发布时间:2022-05-15
下一篇:
PHP path函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap