wordpress图片路径,如何编辑?

时间:2011-06-11 23:38:22

标签: php wordpress path

我在确定图像var的路径时遇到了一个小问题。 这是发生了什么。这是图片标签:

<img src="http://www.xxx.info/wp-content/uploads/http://ecx.images-amazon.com/images/I/51AV8B7CT2L._SL160_.jpg" class="attachment-135x135 wp-post-image" alt="Clean &amp; Sober" title="Clean &amp; Sober">

这就是我希望如何,没有http://www.xxx.info/wp-content/uploads/

<img src="http://ecx.images-amazon.com/images/I/51AV8B7CT2L._SL160_.jpg" class="attachment-135x135 wp-post-image" alt="Clean &amp; Sober" title="Clean &amp; Sober">

这是wordpress代码:

<?php $thumb = '';
$width = 135;
$height = 135;
$classtext = '';
$titletext = get_the_title();
$thumbnail = get_thumbnail($width,$height,$classtext,$titletext,$titletext,false,'Entry');
$thumb = $thumbnail["thumb"]; ?>
<?php print_thumbnail($thumb, $thumbnail["use_timthumb"], $titletext, $width, $height, $classtext); ?>

更多相关功能:

 /* this function prints thumbnail from Post Thumbnail or Custom field or First post image */
function print_thumbnail($thumbnail = '', $use_timthumb = true, $alttext = '', $width = 100, $height = 100, $class = '', $echoout = true, $forstyle = false, $resize = true, $post='') {
    if ( $post == '' ) global $post;
    $output = '';
    $thumbnail_orig = $thumbnail;
    $thumbnail = et_multisite_thumbnail($thumbnail);

    $cropPosition = get_post_meta($post->ID, 'etcrop', true) ? get_post_meta($post->ID, 'etcrop', true) : '';
    if ($cropPosition <> '') $cropPosition = '&amp;a=' . $cropPosition;

    if ($forstyle === false) {
        if ($use_timthumb === false) {
            $output = $thumbnail_orig;
        } else { 
            $output = '<img src="'.get_bloginfo('template_directory').'/timthumb.php?src='.$thumbnail.'&amp;h='. $height .'&amp;w='. $width .'&amp;zc=1&amp;q=90'.$cropPosition.'"';
            if ($class <> '') $output .= " class='$class' ";
            $output .= " alt='$alttext' width='$width' height='$height' />";
            if (!$resize) $output = $thumbnail;
        }
    } else {
        $output = $thumbnail;
        if ($use_timthumb === false) {
            $output = preg_match_all('/<img.+src=[\'"]([^\'"]+)[\'"].*>/i', $output, $matches);
            $output = $matches[1][0];
        } else {
            $output = get_bloginfo('template_directory').'/timthumb.php?src='.$output.'&amp;h='.$height.'&amp;w='.$width.'&amp;q=90&amp;zc=1'.$cropPosition;
        }
    }
    if ($echoout) echo $output;
    else return $output;
    }

这是我在图片代码中返回的$output = $thumbnail_orig;

我知道http://www.xxx.info/wp-content/uploads/应该有一个var 另一个用于http://ecx.images-amazon.com/images/I/51AV8B7CT2L._SL160_.jpg

我想删除uploads的网站路径。

我似乎无法弄清楚, 所有帮助表示赞赏,

由于

1 个答案:

答案 0 :(得分:0)

我可能错了或误解了这个问题,但我认为在WP中设置路径就像在管理面板中编辑它一样简单,在设置下,不是吗?

DC