问题
为了使其正常工作,我必须修改哪些文件?
背景我一直在stackoverflow搜索类似的答案。大多数人都在谈论修改称为php.ini
文件我还没找到。但WordPress主题确实如此吗?
我安装了渡槽主题。我遇到的问题是,这些图像现在将显示为缩略图。这就是我得到错误的地方
错误
Warning: getimagesize() [function.getimagesize]: http:// wrapper is disabled in the server configuration by allow_url_fopen=0 in /nfs/c09/h01/mnt/133267/domains/lame.io/html/wp-content/themes/aqueduct/content.php on line 38
我打开文件进行编辑,但实际上没有看到
allow_url_fopen=0
第38行。
代码
<?php
/**
* @package HowlThemes
*/
?>
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?> itemscope="itemscope" itemtype="http://schema.org/BlogPosting" itemprop="blogPost">
<header class="entry-header">
<?php the_title( sprintf( \'<h2 class="entry-title" itemprop="headline"><a href="%s" rel="bookmark">\', esc_url( get_permalink() ) ), \'</a></h2>\' ); ?>
<?php if ( \'post\' == get_post_type() ) : ?>
<div class="entry-meta">
<div class="postdcp"><?php drag_themes_posted_on(); ?></div>
</div><!-- .entry-meta -->
<?php endif; ?>
</header><!-- .entry-header -->
<div class="entry-content">
<div class="thumbnail-container" itemprop="image">
<?php
if ( get_the_post_thumbnail() != \'\' ) {
echo \'<a href="\'; the_permalink(); echo \'" class="thumbnail-wrapper">\';
$source_image_url = wp_get_attachment_url( get_post_thumbnail_id($post->ID, \'thumbnail\') );
$imginfo = getimagesize($source_image_url);
if($imginfo[0] >= 250 && $imginfo[1] >= 200){
$resizedImage = aq_resize($source_image_url, 250, 200, true);
}
else{
$resizedImage = $source_image_url;
}
echo \'<img src="\';
echo $resizedImage;
echo \'" alt="\';the_title();
echo \'" />\';
echo \'</a>\';
} elseif(howlthemes_catch_that_image()){
$source_image_url = howlthemes_catch_that_image();
$imginfo = getimagesize($source_image_url);
if($imginfo[0] >= 250 && $imginfo[1] >= 200){
$resizedImage = aq_resize($source_image_url, 250, 200, true);
}
else{
$resizedImage = $source_image_url;
}
echo \'<a href="\'; the_permalink(); echo \'" class="thumbnail-wrapper">\';
echo \'<img src="\';
echo $resizedImage;
echo \'" alt="\';the_title();
echo \'" />\';
echo \'</a>\';
}
else{
echo \'<a href="\'; the_permalink(); echo \'" class="thumbnail-wrapper">\';
echo \'<img src="\';
echo esc_url( get_template_directory_uri() );
echo \'/img/thumbnail.jpg" alt="\';the_title();
echo \'" />\';
echo \'</a>\';
}
?>
</div>
<div class="entry-summary" itemprop="text">
<?php the_excerpt(); ?></div>
</div><!-- .entry-content -->
<footer class="entry-footer">
<div class="read-more-button"><a href="<?php the_permalink(); ?>"><?php _e( \'Read More\', \'aqueduct\'); ?> <i class="fa fa-long-arrow-right"></i></a></div>
</footer><!-- .entry-footer -->
</article><!-- #post-## -->
编辑1:
找到了php.ini
文件但我不确定我应该做出什么样的改变
; Rename this file to php.ini and uncomment or add directives.
; For a complete list of valid directives, visit:
; http://us2.php.net/manual/en/ini.php
[PHP]
; We highly recommend that you leave this options enabled
cgi.fix_pathinfo=1
; Increase maximum post size
;post_max_size = 20M
; Increase execution time
;max_execution_time = 300
; pull in EGPCS [Environment, GET, POST, Cookie, Server] variables as globals
;register_globals = true
; For performance reasons, (mt) does not load all of the modules that are available
; into PHP. You may uncomment any one of the following "extension" lines to enable
; the desired module
; Salblotron XSLT
;extension=xslt.so
; save in local tmp
session.save_path=/home/133267/data/tmp
我的经验是使用Ruby,而不是PHP,而且我的WordPress经验有限,所以请像我是全新的一样回答。
最合适的回答,由SO网友:JGallardo 整理而成
我修复了无法看到缩略图的问题。不确定这是否是最佳的长期解决方案,但现在它可以工作了
我将这一行添加到
php.ini
文件
allow_url_fopen = On
我发现服务器上的文件不在
etc
[此网站托管在media temple上,如果找不到,您可能需要联系您自己的主机]
这是我上传的完整文件。有一个php。ini。样品我将其复制到本地编辑,添加行,然后上载回
php。ini公司
; Rename this file to php.ini and uncomment or add directives.
; For a complete list of valid directives, visit:
; http://us2.php.net/manual/en/ini.php
[PHP]
; We highly recommend that you leave this options enabled
cgi.fix_pathinfo=1
; Increase maximum post size
;post_max_size = 20M
; Increase execution time
;max_execution_time = 300
; pull in EGPCS [Environment, GET, POST, Cookie, Server] variables as globals
;register_globals = true
; For performance reasons, (mt) does not load all of the modules that are available
; into PHP. You may uncomment any one of the following "extension" lines to enable
; the desired module
; Salblotron XSLT
;extension=xslt.so
; save in local tmp
session.save_path=/home/133267/data/tmp
allow_url_fopen = On
我找到了关于
php.ini
您可以查看更多详细信息
https://stackoverflow.com/questions/3694240/add-allow-url-fopen-to-my-php-ini-using-htaccess