简体   繁体   English

图像附件在新的WP迁移中引发错误

[英]Image attachments throwing error in new WP migration

I have a WP site that works fine in my testing environment. 我有一个WP网站,可以在我的测试环境中正常工作。 I migrated to a sub-directory on the clients server and now I'm having an issue with image attachments. 我迁移到客户端服务器上的子目录,现在图像附件出现问题。

Fist of all, when I go to the media library, the images are all there, but the thumbnails are not showing, instead, they're replaced with a file icon. 首先,当我进入媒体库时,所有图像都在那里,但是缩略图未显示,而是由文件图标代替。 See screenshot-1 below. 请参阅下面的屏幕截图1。

Secondly, when I try to view the attachment page I'm getting the following errors: 其次,当我尝试查看附件页面时,出现以下错误:

Warning: Illegal string offset 'width' in /xxx/image.php on line 28 警告:第28行的/xxx/image.php中的字符串偏移量'width'非法

Warning: Illegal string offset 'height' in /xxx/image.php on line 29 警告:第29行的/xxx/image.php中的字符串偏移量'height'不合法

Here's the code in the image.php file that is creating the issue: 这是造成问题的image.php文件中的代码:

$metadata = wp_get_attachment_metadata();
printf( __( 'Published <span class="entry-date"><time class="entry-date" datetime="%1$s" pubdate>%2$s</time></span> at <a href="%3$s" title="Link to full-size image">%4$s &times; %5$s</a> in <a href="%6$s" title="Return to %7$s" rel="gallery">%7$s</a>', 'detund' ),
    esc_attr( get_the_date( 'c' ) ),
    esc_html( get_the_date() ),
    wp_get_attachment_url(),
    $metadata['width'],
    $metadata['height'],
    get_permalink( $post->post_parent ),
    get_the_title( $post->post_parent )
);

Specifically, the $metadata['width'] and $metadata['height'] sections. 具体来说, $metadata['width']$metadata['height']部分。

Because of this, functions like WP's featured image, are not working. 因此,诸如WP的特色图像之类的功能无法正常工作。

Has anyone come across this before, or can anyone offer a solution for this issue? 有没有人遇到过这个问题,或者有人可以提供解决方案?

As always, any help is greatly appreciated. 与往常一样,我们非常感谢您的帮助。 Thanks! 谢谢!

截图1

Once I had this issue with one of my client. 一旦我与一位客户遇到这个问题。 Jetpack plugin caused the problem. Jetpack插件引起了问题。 Try disabling it or even disable all active plugins and check whether you still have the problem. 尝试禁用它,甚至禁用所有活动的插件,然后检查是否仍然存在问题。 And even check your file permissions. 甚至检查您的文件权限。

Also check your image url on whether it is pointing to your new url. 还要检查您的图片网址是否指向您的新网址。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM