You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -29,28 +29,23 @@ Here are some of the plugins we use often:
29
29
## Security
30
30
Files stored on S3 are private by default. This means file URLs will be signed and they will expire after some specified time.
31
31
32
-
It's best to explicitly set the expiration time for **each uploader class** using the [url_options](https://shrinerb.com/docs/plugins/url_options) plugin.
33
-
34
-
Some files need to be public, e.g. album covers. In that case, set the `acl` to `public-read` via the [upload_options](https://shrinerb.com/docs/plugins/upload_options) plugin for that uploader class.
35
-
36
-
## Processing images
37
-
If you're uploading images, you should process them (file compression) and create **multiple versions** (derivatives in Shrine) of different sizes. Consult with frontend devs on required dimensions.
38
-
39
-
We use [image_processing gem](https://github.com/janko/image_processing) with the [libvips](https://libvips.github.io/libvips/), which is a better performant alternative to ImageMagick.
40
-
41
-
The **backgrounding** plugin should be combined with the processing for a better user experience.
32
+
It's best to explicitly set the expiration time for **each uploader class** using [url_options](https://shrinerb.com/docs/plugins/url_options) plugin.
42
33
34
+
Some files need to be public, i.e. albums' covers. In that case, set the `acl` to `public-read` via [upload_options](https://shrinerb.com/docs/plugins/upload_options) plugin for that uploader class.
43
35
44
36
## Other guidelines
45
37
46
-
- Use the **jsonb** data type for file columns when possible.
38
+
- Use **jsonb** data type for file columns when possible.
39
+
40
+
- If you're uploading images, you should process them (file compression) and create **multiple versions** (derivatives in Shrine) of different sizes. Consult with frontend devs on required dimensions.
41
+
**Backgrounding** plugin should be combined with the processing for a better user experience.
47
42
48
-
- Always validate the **mime type** for uploaded files, as well as the extension if needed.
43
+
- Always validate **mime type** for uploaded files, and extension if needed.
49
44
50
45
- Shrine doesn't automatically delete files from cache storage when moving them to store storage. Tell a DevOps to **set a lifecycle policy** with an appropriate amount of time **for cache storage** prefix.
51
46
52
47
# Direct S3 upload
53
-
Mobile or web frontends often upload files through the app server, which means that the file does a double hop: from the frontend to the backend, then from the backend to the cloud storage service.
48
+
Mobile or web front ends often upload files through the app server, which means that the file does a double hop: from the frontend to the backend, then from the backend to the cloud storage service.
54
49
55
50
Direct upload solves this double-hop performance problem by giving one-time credentials to the frontend app to upload files directly to the cloud, and it sends out references to those files to the backend.
0 commit comments