0
我有一個小問題,找出一個圖像var的路徑。 這裏是發生了什麼事。這是圖片標籤:wordpress圖片路徑,如何編輯?
<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 & Sober" title="Clean & 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 & Sober" title="Clean & 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 = '&a=' . $cropPosition;
if ($forstyle === false) {
if ($use_timthumb === false) {
$output = $thumbnail_orig;
} else {
$output = '<img src="'.get_bloginfo('template_directory').'/timthumb.php?src='.$thumbnail.'&h='. $height .'&w='. $width .'&zc=1&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.'&h='.$height.'&w='.$width.'&q=90&zc=1'.$cropPosition;
}
}
if ($echoout) echo $output;
else return $output;
}
這就是我在圖像標記中返回$output = $thumbnail_orig;
。
我知道,應該有http://www.xxx.info/wp-content/uploads/
一個變種,另一個用於http://ecx.images-amazon.com/images/I/51AV8B7CT2L._SL160_.jpg
我想刪除到uploads
的網站路徑。
我似乎無法弄清楚, 感謝所有幫助,
感謝
不是在這種情況下 – Patrioticcow 2011-06-12 00:09:16
爲什麼?你能提供更多的細節嗎?如果沒有,爲什麼你要編輯WP內核? – 2011-06-12 02:07:00