Class: VenusMediaLibrary::AssetsController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- VenusMediaLibrary::AssetsController
- Defined in:
- app/controllers/venus_media_library/assets_controller.rb
Instance Method Summary collapse
Instance Method Details
#show ⇒ Object
3 4 5 6 7 |
# File 'app/controllers/venus_media_library/assets_controller.rb', line 3 def show asset = visible_media_assets.find(params[:id]) send_data asset.blob.download, filename: asset.blob.filename.to_s, type: asset.blob.content_type, disposition: "inline" end |
#thumbnail ⇒ Object
9 10 11 12 13 14 15 16 17 18 |
# File 'app/controllers/venus_media_library/assets_controller.rb', line 9 def thumbnail asset = visible_media_assets.find(params[:id]) blob = asset.blob return redirect_to asset_path(asset) unless blob.variable? width, height = VenusMediaLibrary.configuration.thumbnail_size representation = blob.variant(resize_to_limit: [ width, height ]).processed send_data representation.download, filename: blob.filename.to_s, type: representation.image.content_type, disposition: "inline" end |