Wordpress - 图片未显示在媒体库中
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/8438193/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Wordpress - Images not showing up in the Media Library
提问by Fredy31
I have a huge problem with my Wordpress. My uploaded images don't list in the Media Library.
我的 Wordpress 有一个大问题。我上传的图片未在媒体库中列出。
It is weird tho, it says I have 75 images, but display none. Take a look yourself.
这很奇怪,它说我有 75 张图像,但没有显示。自己看看吧。
Even weirder, if I go into gallery (the images you uploaded in the page itself), the images list just fine.
更奇怪的是,如果我进入图库(您在页面中上传的图像),图像列表就好了。
I already tried deactivating all my plugins, didn't work. Cache can be easily put out of the question, because it happened on at least 4 different computers, with Macs, PCs, and navigating with Safari, Firefox and Chrome.
我已经尝试停用我所有的插件,没有用。缓存很容易被排除在外,因为它发生在至少 4 台不同的计算机上,使用 Mac、PC,并使用 Safari、Firefox 和 Chrome 导航。
Another interesting fact is that if I upload the image directly trough the computer (with the "From Computer" tab), everything goes fine. Another website on the same server works just fine too. And just to add to the complexity, when I go to the media page in the Wordpress Admin, all images show up just fine.
另一个有趣的事实是,如果我直接通过计算机上传图像(使用“来自计算机”选项卡),一切都会很好。同一台服务器上的另一个网站也能正常工作。为了增加复杂性,当我转到 Wordpress Admin 中的媒体页面时,所有图像都显示得很好。
Oh, and before I forget... applying any filters, or doing a research in the media will always come up with the same problem.
哦,在我忘记之前......应用任何过滤器或在媒体中进行研究总会遇到同样的问题。
So there... that's where I'm at.
所以……这就是我所在的地方。
采纳答案by Kashif Rafique
How did you upload those images; via FTP or through WP uploader? You have to upload images THROUGH WP uploader in order to show them in the image library.
你是怎么上传这些图片的;通过 FTP 还是通过 WP 上传器?您必须通过 WP 上传器上传图像才能在图像库中显示它们。
回答by Tony Blackwood
I had a same problem just now, with missing media library images for my blog. The images appeared to be right there in the media library and were definitely on the actual web server (checked via FTP).
我刚才遇到了同样的问题,我的博客缺少媒体库图片。这些图像似乎就在媒体库中,而且肯定在实际的 Web 服务器上(通过 FTP 检查)。
As Allen Z advised I did "check Settings → Media and make sure that Uploading Files folder is set to wp-content/uploads"
正如 Allen Z 所建议的那样,我确实“检查了设置 → 媒体并确保将上传文件文件夹设置为 wp-content/uploads”
Mine were set to the default blank. I altered this to an absolute path http://www.example.com/wp-content/uploads
我的设置为默认空白。我将其更改为绝对路径http://www.example.com/wp-content/uploads
THIS DIDNT SOLVE THE PROBLEM when I refreshed the site in browser. However, I immediately changed the path back to blank (the default setting again) and everything came back! Woop
当我在浏览器中刷新站点时,这并没有解决问题。但是,我立即将路径改回空白(再次默认设置),一切又回来了!呜呜
Everyone having this problem might want to try this before getting into the more technical fixes!
遇到此问题的每个人都可能想在进行更多技术修复之前尝试一下!
回答by aaron
it was your permalinks... you must have changed to labeled-name... switch back to default.
这是您的永久链接……您必须更改为标签名称……切换回默认值。
that worked for me.
这对我有用。
回答by Allen Z.
Check Screen Options (dropdown tab in the upper right hand corner of the page), and make sure there are sane settings for what to show on screen. All the column settings should be checked, and there should be a positive number of media items being shown on screen.
检查屏幕选项(页面右上角的下拉选项卡),并确保屏幕上显示的内容设置合理。应检查所有列设置,并且屏幕上应显示正数量的媒体项。
If that is ok, then check Settings → Media and make sure that Uploading Files folder is set to wp-content/uploads
.
如果没问题,然后检查设置 → 媒体并确保上传文件文件夹设置为wp-content/uploads
。
I believe these are the only settings that can be changed from the administrative screens.
我相信这些是唯一可以从管理屏幕更改的设置。
回答by Limerick 2030
Here's something a guy on Wordpress forum showed us. Add the following to your functions.php file. (remember to create a backup of your functions.php first)
这是 Wordpress 论坛上的一个人向我们展示的东西。将以下内容添加到您的 functions.php 文件中。(记得先备份你的functions.php)
add_filter( 'wp_image_editors', 'change_graphic_lib' );
function change_graphic_lib($array) {
return array( 'WP_Image_Editor_GD', 'WP_Image_Editor_Imagick' );
}
...it was that simple.
……就是这么简单。
回答by richy
I had this problem with wordpress 3.8.1 and it turned out that my functions.php wasn't saved as utf-8. Re-saved it and it
我在 wordpress 3.8.1 上遇到了这个问题,结果我的 functions.php 没有保存为 utf-8。重新保存它和它
回答by Fredy31
Well, Seems like there was a bug when creating custom post types in the function.php file of the theme... which bugged that.
好吧,似乎在主题的 function.php 文件中创建自定义帖子类型时出现了一个错误......
回答by Pavnish Yadav
I faced same issue on my wordpress site. After the lot of debugging i fixed my problem step by step like this.
我在我的 wordpress 网站上遇到了同样的问题。经过大量调试后,我像这样一步一步地解决了我的问题。
- First add given below code your db-config.php
- 首先添加下面给出的代码你的 db-config.php
define('SCRIPT_DEBUG', TRUE); define('WP_DEBUG', TRUE); define( 'WP_DEBUG_LOG', true );
define('SCRIPT_DEBUG', TRUE); define('WP_DEBUG', TRUE); define( 'WP_DEBUG_LOG', true );
- Then goto /wp-includes/js/wp-util.js files and find the code $.ajax( options ) on line number 100 insert given below code into your file
- 然后转到 /wp-includes/js/wp-util.js 文件并在第 100 行找到代码 $.ajax( options ) 将下面给出的代码插入到您的文件中
deferred.jqXHR = $.ajax( options ).done( function( response ) { try { response = JSON.parse(response); } catch (Exception) { response = response; }
deferred.jqXHR = $.ajax( options ).done( function( response ) { try { response = JSON.parse(response); } catch (Exception) { response = response; }
Please check your may be resolved.
请检查您是否可以解决。
- if you Removed constant from db-config.php
- 如果您从 db-config.php 中删除了常量
define('SCRIPT_DEBUG', TRUE); define('WP_DEBUG', TRUE); define( 'WP_DEBUG_LOG', true );
define('SCRIPT_DEBUG', TRUE); define('WP_DEBUG', TRUE); define( 'WP_DEBUG_LOG', true );
- Then compress your /wp-includes/js/wp-util.js file code and put your compressed code into /wp-includes/js/wp-util.min.js
- 然后压缩您的/wp-includes/js/wp-util.js 文件代码并将您的压缩代码放入/wp-includes/js/wp-util.min.js
*change your own risk if your update your wordpress version your changed may be lost.
*更改您自己的风险,如果您更新您更改的 wordpress 版本可能会丢失。
回答by Amin
check .htaccessfile in root of wordpress, maybe there is a rule for /uploads directory. if so, remove it. but be careful and check which plugin did it, so disable the plugin, first.
检查wordpress 根目录中的.htaccess文件,也许 /uploads 目录有规则。如果是这样,请将其删除。但要小心并检查哪个插件做了它,所以首先禁用插件。
回答by u5675325
Considering the files were not uploaded via media uploader, they are present in the server but there's no reference to them in your database (in a little more detail).
考虑到文件不是通过媒体上传器上传的,它们存在于服务器中,但在您的数据库中没有对它们的引用(更详细一点)。
In order to fix it, install the Media Sync plugin. Once it's active, under Media > Media Sync > Scan Files and select the files you want to import by click the checkbox next to them. Make sure also you untick the selectbox Dry Run (test without making database changes).
为了修复它,安装媒体同步插件。激活后,在“媒体”>“媒体同步”>“扫描文件”下,通过单击旁边的复选框来选择要导入的文件。确保还取消选中选择框试运行(测试而不进行数据库更改)。
Then, when the time comes for you to be ready, just click "Import Selected" and you should see something like this
然后,当您准备就绪时,只需单击“导入所选”,您应该会看到类似这样的内容
Once it is finished, you can visit Media > Library and you'll see all your imported files there.
完成后,您可以访问媒体 > 库,您将在那里看到所有导入的文件。
回答by Victor Stoddard
Did you ever change the directory of your Wordpress install?
你有没有改变过你的 Wordpress 安装目录?
I had a problem with not finding my uploaded images after changing the Wordpress location on my server. In Wordpress, I went to Dashboard-> Settings -> Media and changed the uploads folder in the "Store uploads in this folder" field.
在更改服务器上的 Wordpress 位置后,我遇到了找不到上传图像的问题。在 Wordpress 中,我转到仪表板-> 设置-> 媒体并更改“在此文件夹中存储上传”字段中的上传文件夹。