WordPress在您的网站上的哪里存储图像?

Are you wondering where does WordPress store images on your website? Many beginners users have asked us how does WordPress store images and what they can do to organize their media library more effectively. In this article, we will explain how WordPress stores images on your site.

您是否想知道WordPress在您的网站上存储图像的位置? 许多初学者用户已经问我们WordPress如何存储图像,以及他们可以做什么来更有效地组织媒体库。 在本文中,我们将说明WordPress如何在您的网站上存储图像。

Where does WordPress store images on your site
WordPress如何存储图像? (How Does WordPress Store Images?)

WordPress comes with a built-in system to manage your media uploads like images, videos, music, documents, etc. This system allows you to upload, manage, edit, and delete files from your WordPress media library.

WordPress随附有一个内置系统来管理您的媒体上载,例如图像,视频,音乐,文档等。此系统允许您从WordPress媒体库中上载,管理,​​编辑和删除文件。

Media Library view in WordPress admin area

By default, WordPress stores all your images and media uploads in /wp-content/uploads/ folder on your server. All uploads are organized in a month and year based folders.

默认情况下,WordPress将所有图像和媒体上载存储在服务器上的/ wp-content / uploads /文件夹中。 所有上载都基于一个月和一年的文件夹。

For example, all your media files uploaded in in March 2016 will be stored in:

例如,您在20163月上传的所有媒体文件都将存储在:

/wp-content/uploads/2016/03/

/wp-content/uploads/2016/03/

You can view these folders by connecting to your WordPress site using an FTP client.

您可以通过使用FTP客户端连接到WordPress网站来查看这些文件夹。

FTP view of uploads directory of a WordPress site

WordPress also adds information about your image uploads in the database. Information about your uploads is stored in database as a attachment post type under the posts table.

WordPress还会在数据库中添加有关您的图像上传的信息。 有关您上载的信息作为帖子表下方的附件 帖子类型存储在数据库中。

Database entry for attachment post type as seen in phpMyAdmin

WordPress also saves information in posts meta table when you insert images into posts/pages or any other custom post type.

当您将图像插入帖子/页面或任何其他自定义帖子类型时,WordPress还将信息保存在帖子元表中。

When you set featured image also known as thumbnails, WordPress saves this information as a meta key _thumbnail_id and stores it in the postmeta table of your database.

当您设置特色图像(也称为缩略图)时,WordPress将该信息保存为元密钥_thumbnail_id并将其存储在数据库的postmeta表中。

Thumbnail ID meta key stored in postmeta table

Deleting your files from server using an FTP client will remove them from your server, but it will not remove them from the WordPress database. Those images will continue to appear on your WordPress site as broken images.

使用FTP客户端从服务器删除文件会将其从服务器中删除,但不会将其从WordPress数据库中删除。 这些图像将继续以损坏的图像形式出现在您的WordPress网站上。

Similarly, if you delete references to your images and media uploads from database, then WordPress will stop showing them in the Media library. Even if all your images are intact and stored on your server.

同样,如果您从数据库中删除对图像和媒体上载的引用,则WordPress将停止在媒体库中显示它们。 即使所有图像都完整无缺并存储在服务器上。

更改WordPress存储图像和媒体上传的方式 (Changing How WordPress Stores Images and Media Uploads)

By default, WordPress does not allow you to change the uploads location from WordPress admin area. The only change you can make is to disable the month and year based folders by visiting Settings » Media page.

默认情况下,WordPress不允许您从WordPress 管理区域更改上传位置。 您唯一可以做的更改是通过访问设置»媒体页面来禁用基于月份和年份的文件夹。

Organizing uploads in months and year based folders

Simply uncheck the box next to ‘Organize my uploads into month- and year-based folders’ option and save your changes. WordPress will start storing your files directly in /wp-content/uploads/ folder.

只需取消选中“将我的上传组织到基于月和年的文件夹中”选项旁边的框然后保存您的更改。 WordPress将开始直接将文件存储在/ wp-content / uploads /文件夹中。

Advanced WordPress users can use a custom upload directory instead of the default location. See our guide on how to change the default media upload location in WordPress.

高级WordPress用户可以使用自定义上传目录代替默认位置。 请参阅我们的指南,了解如何在WordPress中更改默认媒体上传位置

在WordPress中整理图片 (Organizing Your Images in WordPress)

WordPress does not allow you to use custom folders when uploading your images. This makes it difficult for users to organize their images in a folder based structure.

WordPress不允许您在上传图片时使用自定义文件夹。 这使得用户难以以基于文件夹的结构来组织其图像。

However, you can use image tagging to organize your WordPress media uploads. WordPress gallery plugins like Envira Gallery make image organization easier with albums and image tags.

但是,您可以使用图像标记来组织WordPress媒体上传。 诸如Envira Gallery之类的WordPress画廊插件通过相册和图像标签使图像组织更加容易。

We hope this article helped you learn where does WordPress store images on your site. You may also want to see our guide on how to find royalty free images for your WordPress blog.

我们希望本文能帮助您了解WordPress在您的网站上存储图像的位置。 您可能还想看看我们的指南,该指南介绍了如何为WordPress博客找到免版税图片

If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.

如果您喜欢这篇文章,请订阅我们的YouTube频道 WordPress视频教程。 您也可以在TwitterFacebook上找到我们。

翻译自: https://www.wpbeginner.com/beginners-guide/where-does-wordpress-store-images-on-your-site/

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值