Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
mastodon
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Pierre Boudes
mastodon
Commits
06dd3592
Commit
06dd3592
authored
8 years ago
by
Eugen Rochko
Browse files
Options
Downloads
Patches
Plain Diff
Downsize attachment previews, but improve quality from 80 to 90
parent
bf5f8a24
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
app/models/media_attachment.rb
+3
-3
3 additions, 3 deletions
app/models/media_attachment.rb
with
3 additions
and
3 deletions
app/models/media_attachment.rb
+
3
−
3
View file @
06dd3592
...
...
@@ -10,7 +10,7 @@ class MediaAttachment < ApplicationRecord
has_attached_file
:file
,
styles:
->
(
f
)
{
file_styles
f
},
processors:
->
(
f
)
{
f
.
video?
?
[
:transcoder
]
:
[
:thumbnail
]
},
convert_options:
{
all:
'-quality
8
0 -strip'
}
convert_options:
{
all:
'-quality
9
0 -strip'
}
validates_attachment_content_type
:file
,
content_type:
IMAGE_MIME_TYPES
+
VIDEO_MIME_TYPES
validates_attachment_size
:file
,
less_than:
4
.
megabytes
...
...
@@ -45,14 +45,14 @@ class MediaAttachment < ApplicationRecord
if
f
.
instance
.
image?
{
original:
'1280x1280>'
,
small:
'
510x68
0>'
,
small:
'
250x25
0>'
,
}
else
{
small:
{
convert_options:
{
output:
{
vf:
'scale=\'min(5
1
0\, iw):min(
68
0\, ih)\':force_original_aspect_ratio=decrease'
,
vf:
'scale=\'min(
2
50\, iw):min(
25
0\, ih)\':force_original_aspect_ratio=decrease'
,
},
},
format:
'png'
,
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment