Class: Pageflow::ImageFile
Instance Method Summary
collapse
#ready?, #retry!, #retryable?
Methods included from HostedFile
#attachment, #attachment=, #basename, #can_upload?, #ready?, #retryable?
#cache_key, #can_upload?, #direct_upload_config, #file_type, #nested_files, #parent_allows_type_for_nesting, #parent_belongs_to_same_entry
Instance Method Details
#attachment_default_url ⇒ Object
33
34
35
|
# File 'app/models/pageflow/image_file.rb', line 33
def attachment_default_url
':pageflow_placeholder'
end
|
#attachment_styles(attachment) ⇒ Object
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
|
# File 'app/models/pageflow/image_file.rb', line 6
def attachment_styles(attachment)
panorama_format = File.extname(attachment.original_filename) == '.png' ? :PNG : :JPG
Pageflow
.config.thumbnail_styles
.merge(
print: {geometry: '300x300>',
format: :JPG,
convert_options: '-quality 10 -interlace Plane'},
medium: {geometry: '1024x1024>',
format: :JPG,
convert_options: '-quality 70 -interlace Plane'},
large: {geometry: '1920x1920>',
format: :JPG,
convert_options: '-quality 70 -interlace Plane'},
ultra: {geometry: '3840x3840>',
format: :JPG,
convert_options: '-quality 90 -interlace Plane'},
panorama_medium: {geometry: '1024x1024^',
format: panorama_format,
convert_options: '-quality 90 -interlace Plane'},
panorama_large: {geometry: '1920x1080^',
format: panorama_format,
convert_options: '-quality 90 -interlace Plane'}
)
end
|
#attachments_path_name ⇒ Object
used in paperclip initializer to interpolate the storage path needs to be “processed_attachments” for images for legacy reasons
39
40
41
|
# File 'app/models/pageflow/image_file.rb', line 39
def attachments_path_name
'processed_attachments'
end
|
#original_url ⇒ Object
56
57
58
|
# File 'app/models/pageflow/image_file.rb', line 56
def original_url
attachment.url if ready?
end
|
#panorama_url ⇒ Object
60
61
62
|
# File 'app/models/pageflow/image_file.rb', line 60
def panorama_url
attachment.url(:panorama_large) if ready?
end
|
#thumbnail_url(*args) ⇒ Object
#url ⇒ Object
52
53
54
|
# File 'app/models/pageflow/image_file.rb', line 52
def url
attachment.url(:large) if ready?
end
|