-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathuploadcare.rb
142 lines (113 loc) · 7.47 KB
/
uploadcare.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
# frozen_string_literal: true
# Uncomment this string in case of using locales for locale_translations parameter
I18n.load_path += Dir[Rails.root.join("config", "locales", "*.{rb,yml}").to_s]
Uploadcare::Rails.configure do |config|
# Sets your Uploadcare public key.
config.public_key = ENV.fetch("UPLOADCARE_PUBLIC_KEY", "demopublickey")
# Deletes files from Uploadcare servers after object destroy.
config.delete_files_after_destroy = true
# Sets caching for Uploadcare files
config.cache_files = true
# If true, only image files are allowed to be uploaded.
# config.images_only = false
# If true, the preview step is present after selecting files.
# Otherwise, the file uploader dialog closes when the selection is complete.
# config.preview_step = false
# Defines the file uploader manual crop behavior (see https://uploadcare.com/docs/uploads/file-uploader/#crop-option).
# When uploading images, your users can select a crop area.
# This option does not force your file uploader to accept images only.
# The option also works in the multi-file mode since version 2.3.0.
# config.crop = 'disabled'
# Saves traffic and storage space by resizing images on a client before uploading.
# See the detailed option description for details. Using the client-side resize does not force the images only option.
# config.image_shrink = ''
# Allows user to remove uploaded files from the file uploader.
# Please note that those files are not deleted from your account.
# config.clearable = true
# Allows you to define which upload sources you want to use with the file uploader.
# The value is represented by a space-separated ordered list of upload source names.
# See https://uploadcare.com/docs/uploads/file-uploader/#upload-sources for details.
# config.tabs = 'url file facebook'
# Sets the accept attribute for the file uploader dialog.
# If the images only option is disabled, the value is empty.
# Otherwise, the default value is image/*.
# null means accept should be kept empty regardless of the images only value.
# For other possible values, see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/Input#attr-accept
# Note, this is not a replacement for
# our file validation (see https://uploadcare.com/docs/file-uploader-api/file-validation/)
# because your users will still be able to choose any file via drag&drop or from URL.
# config.input_accept_types = 'image/*'
# Defines the list of preferred MIME types.
# The list should be ordered and contain space-separated MIME types.
# Common parts can be marked with asterisks: image/* application/vnd.openxmlformats-officedocument.*.
# If no MIME types match the criteria or preferred types are not set, default formats are used.
# Keep in mind that some cloud services can export data in different formats.
# For example, Google document can be exported as Word document, PDF or plain text.
# config.preferred_types = 'image/* application/vnd.openxmlformats-officedocument.*'
# Forces a system-native file picking dialog to show up instead of our file uploader.
# That makes the file uploader behavior as close as possible to the generic <input type="file">.
# Native behavior is achieved at the expense of support for uploading content
# from social media and cloud storage, manual crop, and preview step.
# Multi-file selection would still work.
# The option does not work in old browser versions: the dialog falls back to the file uploader.
# config.system_dialog = false
# This option sets the file size threshold for multipart uploading.
# The value ranges from 10485760 (10 MB), which is default, up to 104857600 (100 MB).
# If a file size hits the threshold, it gets uploaded in four parallel chunks by 5 MB.
# Multipart upload makes large file uploading faster.
# Files go directly to a storage, bypassing our upload servers,
# and they're quickly available for further use. All files below the threshold get uploaded in one piece.
# Note: Multipart upload works with local sources only (files and camera).
# config.multipart_min_size = 10485760
# Available locales currently are:
# ar az ca cs da de el en es et fr he it ja ko lv nb nl pl pt ro ru sk sr sv tr uk vi zhTW zh
config.locale = "en"
# Sets custom localization options. See https://uploadcare.com/docs/uploads/file-uploader/#localization
config.locale_translations = I18n.t("uploadcare_widget_translations")
# Defines pluralization options. See https://uploadcare.com/docs/uploads/file-uploader/#pluralization
# config.locale_pluralize = {}
# The signature is an HMAC/SHA256 hex-encoded hash that includes secret_key and expire strings.
# To use Secure Uploading for your project, you need to make a signature on your back end using your
# project's Secret Key and provide it to File Uploader.
# Learn how to make your signature in docs - https://uploadcare.com/docs/security/secure-uploads/
# config.secure_signature = ''
# Stands for the Unix time to which the signature is valid, e.g., 1454902434.
# Works together with the secure signature option that defines a period of your signature validity.
# config.secure_expire = 1454902434
# The option can be used with Authenticated URLs. Defines your proxy backend URL.
# See https://uploadcare.com/docs/security/secure-delivery/#proxy-backend.
# config.preview_proxy = ''
# The option can be used with Authenticated URLs.
# Defines the function that specifies which URL a file uploader should use for image previews.
# Function signature is (originalUrl, fileInfo) => previewUrl.
# If this option is specified, option previewProxy will be ignored.
# config.preview_url_callback = {}
# If true, inputs on your page are initialized automatically, see the article for details -
# https://uploadcare.com/docs/file-uploader-api/widget-initialization/
config.live = true
# If true, input initialization is invoked manually.
# See https://uploadcare.com/docs/file-uploader-api/widget-initialization/).
config.manual_start = false
# Defines your schema and CDN domain.
# Can be changed to one of the predefined values (https://uploadcare.com/docs/delivery/cdn/) or your custom CNAME.
# config.cdn_base = 'https://ucarecdn.com/'
config.cdn_hostname = "ucarecdn.com"
# Forces files uploaded with a file uploader not to be stored.
# See https://uploadcare.com/docs/uploads/storage/#storing-uploaded-files.
# For instance, you might want to turn this on when automatic file storing is enabled in your project,
# but you do not want to store files uploaded with a particular file uploader.
# config.do_not_store = false
# Allows you to adjust the quality of an audio recorded via the file uploader Camera Tab.
# Refer the link to learn more - https://developer.mozilla.org/en-US/docs/Web/API/MediaRecorder/MediaRecorder.
# config.audio_bits_per_second = 1
# Allows you to specify the MIME types.
# The first supported by the browser will be used as an option of
# video stream captured via the file uploader Camera Tab.
# Refer the link to learn more - https://developer.mozilla.org/en-US/docs/Web/API/MediaRecorder/MediaRecorder.
# config.video_preferred_mime_types = ''
# Allows you to adjust the quality of a video stream captured via the file uploader Camera Tab.
# Refer the link to learn more - https://developer.mozilla.org/en-US/docs/Web/API/MediaRecorder/MediaRecorder.
# config.video_bits_per_second = 1
# Allows you to set the default state of image/video mirorring in the camera tab.
# config.camera_mirror_default = true
end