Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/254.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php Wordpress打印缩略图未提供正确的url_Php_Apache_Wordpress - Fatal编程技术网

Php Wordpress打印缩略图未提供正确的url

Php Wordpress打印缩略图未提供正确的url,php,apache,wordpress,Php,Apache,Wordpress,我在这个问题上一直很为难。 我在Ubuntu服务器64位上运行Wordpress 3.3.1 因此,我可以上传一张图片,并使用提供的url查看它。 但是,当我将其设置为特征图像时,函数 print_缩略图没有给我正确的地址。 它正在添加/var/www/before my/wp content/uploads/etc。。。 因此,借助一些符号链接,绝对路径名在我的机器上是正确的 我尝试更改文件上的css以删除/var/www/,并验证这确实找到了我的图像并起到了作用。我已经看到很多帖子告诉我将c

我在这个问题上一直很为难。 我在Ubuntu服务器64位上运行Wordpress 3.3.1

因此,我可以上传一张图片,并使用提供的url查看它。 但是,当我将其设置为特征图像时,函数 print_缩略图没有给我正确的地址。 它正在添加/var/www/before my/wp content/uploads/etc。。。 因此,借助一些符号链接,绝对路径名在我的机器上是正确的

我尝试更改文件上的css以删除/var/www/,并验证这确实找到了我的图像并起到了作用。我已经看到很多帖子告诉我将chmod 777改回755,如中所示,我不知道这应该如何解决这个问题,因为这似乎是一个路径问题。是否存在基于权限的某种重定向?不管怎么说,它不起作用

有人有什么想法吗

下面是一个示例帖子

您可以尝试使用此选项,而不是
打印缩略图

<?php
if ( has_post_thumbnail() ) {
    the_post_thumbnail(); // Outputs <img/> object with src="thumbnail-href"
}

在这个函数中,我发现它使用get_bloginfo函数打印样式表目录

$output = '<img src="'.get_bloginfo('stylesheet_directory').'/timthumb.php?src='.$thumbnail.'&amp;h='. $height .'&amp;w='. $width .'&amp;zc=1"';
$output=
在报告中,它说:

“样式表目录”-返回 活动主题。(在早期的WordPress版本中是本地路径。) 考虑使用,

将get_bloginfo('stylesheet_directory')更改为get_stylesheet_directory_uri()
我自己没有试过,希望能有帮助

<?php
add_theme_support( 'post-thumbnails' );
set_post_thumbnail_size( 120, 120 );
add_image_size( 'subfeature', 940, 300 );
<?php
if ( has_post_thumbnail() ) {
    echo( get_the_post_thumbnail( get_the_ID(), 'subfeature' ) );
}
$output = '<img src="'.get_bloginfo('stylesheet_directory').'/timthumb.php?src='.$thumbnail.'&amp;h='. $height .'&amp;w='. $width .'&amp;zc=1"';