Module: GeoConcerns::FileSet::Derivatives
- Extended by:
- ActiveSupport::Concern
- Included in:
- GeoFileSetBehavior
- Defined in:
- app/models/concerns/geo_concerns/file_set/derivatives.rb
Instance Method Summary collapse
- #create_derivatives(filename) ⇒ Object
- #raster_derivatives(filename) ⇒ Object
- #vector_derivatives(filename) ⇒ Object
Instance Method Details
#create_derivatives(filename) ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 |
# File 'app/models/concerns/geo_concerns/file_set/derivatives.rb', line 6 def create_derivatives(filename) case geo_mime_type when *GeoConcerns::RasterFormatService..map(&:last) raster_derivatives(filename) when *GeoConcerns::VectorFormatService..map(&:last) vector_derivatives(filename) end super # Once all the derivatives are created, send a derivatives created message geo_concerns_messenger.derivatives_created(self) end |
#raster_derivatives(filename) ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'app/models/concerns/geo_concerns/file_set/derivatives.rb', line 19 def raster_derivatives(filename) GeoConcerns::Runners::RasterDerivatives .create(filename, outputs: [{ input_format: geo_mime_type, label: :display_raster, id: id, format: 'tif', url: derivative_url('display_raster') }, { input_format: geo_mime_type, label: :thumbnail, id: id, format: 'png', size: '200x150', url: derivative_url('thumbnail') }]) end |
#vector_derivatives(filename) ⇒ Object
34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'app/models/concerns/geo_concerns/file_set/derivatives.rb', line 34 def vector_derivatives(filename) GeoConcerns::Runners::VectorDerivatives .create(filename, outputs: [{ input_format: geo_mime_type, label: :display_vector, id: id, format: 'zip', url: derivative_url('display_vector') }, { input_format: geo_mime_type, label: :thumbnail, id: id, format: 'png', size: '200x150', url: derivative_url('thumbnail') }]) end |