Skip to main content

Strapi 云的上传大小限制

🌐 Upload size limits for Strapi Cloud

Page summary:

所有方案中,非图片文件的大小上限为 200 MB。图片文件的推荐最大值基于内存,并根据格式、方案以及媒体库设置而有所不同。要上传更大的图片,请禁用响应式友好上传和尺寸优化。

Strapi Cloud 对上传应用两种不同的限制。第一种是硬性最大文件大小限制,在基础设施层面对非图片文件强制执行。第二种是基于内存的对图片文件的推荐限制,取决于你的 CMS 设置。

🌐 Strapi Cloud applies 2 distinct limits to uploads. The first is a hard maximum file size, enforced at the infrastructure level for non-image files. The second is a memory-based recommendation for image files that depends on your CMS settings.

非图片文件的最大上传文件大小

🌐 Maximum upload file size for non-image files

在所有 Strapi Cloud 计划中,非图片上传的大小上限为 200 MB。该上限在基础设施层面执行,无法通过 strapi::body 中间件配置覆盖。

🌐 Non-image uploads are capped at 200 MB on all Strapi Cloud plans. The cap is enforced at the infrastructure level and cannot be overridden via the strapi::body middleware configuration.

🌐 Recommended maximum upload size for image files

图片上传受额外的、基于内存的推荐限制,该限制独立于非图片上限,并且因图片格式而异。

🌐 Image uploads are subject to an additional, memory-driven recommendation that is independent of the non-image cap and varies by image format.

Uploading a large image?

要上传大于建议最大值的图片,请在媒体库设置中同时禁用响应式友好上传和大小优化。这样,CMS 将按原样存储源文件,而不进行处理,从而提高建议的最大值(请参见下表中的 处理关闭 值)。

🌐 To upload an image larger than the recommended maximum, disable both Responsive friendly upload and Size optimization in the Media Library settings. The CMS then stores the source file as-is without in-process processing, which raises the recommended maximum (see the Processing off values in the tables below).

当在媒体库设置中同时启用响应式友好上传和大小优化时,CMS 会调整源图片的大小,并在保存之前在实例的内存中生成一组缩略图(小、中、大)。此处理在进程内进行,无论配置的上传提供者如何。

🌐 When Responsive friendly upload and Size optimization are both enabled in the Media Library settings, the CMS resizes the source image and generates a set of thumbnails (small, medium, large) in the instance's memory before persisting them. This processing happens in-process, regardless of the configured upload provider.

切换到第三方提供商(Amazon S3、Cloudinary 等)并不是一个解决方法。调整大小和生成缩略图的步骤仍然在 Strapi Cloud 实例内部运行,并且仍然需要与源图片尺寸成比例的内存。

🌐 Switching to a third-party provider (Amazon S3, Cloudinary, etc.) is not a workaround. The resize and thumbnail generation step still runs inside the Strapi Cloud instance and still requires memory proportional to the source image dimensions.

实际内存使用情况取决于图片的尺寸、格式以及你的媒体库设置。以下表格中的数值仅为推荐值,而非硬性限制。超过推荐大小的上传很可能导致实例内存不足并重启。

🌐 Actual memory usage depends on the image dimensions, format, and your Media Library settings. The values in the following tables are a recommendation, not a hard limit. Uploads above the recommended size are likely to cause the instance to run out of memory and restart.

该建议取决于媒体库设置中是否启用了响应式友好上传和尺寸优化:

🌐 The recommendation depends on whether Responsive friendly upload and Size optimization are enabled in the Media Library settings:

  • 处理于:两个设置均已启用,使用默认的 smallmediumlarge 尺寸。Strapi 在内存中生成缩略图,因此安全上传大小较小。
  • 处理关闭:两个设置均已禁用。源图片将按原样存储,不进行处理,因此安全上传大小更高。

每种格式和计划的推荐最大图片尺寸,以兆像素(MP)表示:

🌐 Recommended maximum image size, expressed in megapixels (MP), per format and plan:

格式初级专业与商业
JPEG26 MP135 MP
PNG10 MP90 MP
WebP4 MP12 MP
TIFF24 MP125 MP
AVIF92 MP92 MP
Converting pixels to megapixels

图片的百万像素数是其宽度乘以高度的像素数,然后除以1,000,000。与给定百万像素数匹配的像素尺寸取决于纵横比。对于正方形图片,1百万像素大约是1000×1000像素,4百万像素大约是2000×2000像素,而100百万像素大约是10000×10000像素。

🌐 The number of megapixels of an image is its width multiplied by its height in pixels, divided by 1,000,000. The pixel dimensions that match a given megapixel count depend on the aspect ratio. For a square image, 1 MP is roughly 1000×1000 px, 4 MP is roughly 2000×2000 px, and 100 MP is roughly 10000×10000 px.

Configuring a provider

要配置诸如 Amazon S3 或 Cloudinary 之类的外部存储,请参阅 Strapi Cloud 的上传提供程序配置

🌐 To configure external storage such as Amazon S3 or Cloudinary, see Upload Provider Configuration for Strapi Cloud.