Sha256: f140e1120a3ede9c92661a1a0bbf746efbd86598c1e19952aafcceadd3af8b98

Contents?: true

Size: 683 Bytes

Versions: 19

Compression:

Stored size: 683 Bytes

Contents

module Spina::Api
  class ImageSerializer < BaseSerializer    
    set_type :image
    
    attributes :id
    
    attribute :original_url do |image, params|
      params[:view_context].main_app.url_for(image.file)
    end
    
    attribute :thumbnail_url do |image, params|
      params[:view_context].main_app.url_for(image.variant(resize_to_fill: Spina.config.thumbnail_image_size))
    end
    
    attribute :embedded_image_size_url do |image, params|
      resize_key = Spina.config.embedded_image_size.is_a?(Array) ? :resize_to_limit : :resize
      params[:view_context].main_app.url_for(image.variant(Hash[resize_key, Spina.config.embedded_image_size]))
    end
  end
end

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
spina-2.12.0 app/serializers/spina/api/image_serializer.rb
spina-2.11.0 app/serializers/spina/api/image_serializer.rb
spina-2.10.0 app/serializers/spina/api/image_serializer.rb
spina-2.9.1 app/serializers/spina/api/image_serializer.rb
spina-2.9.0 app/serializers/spina/api/image_serializer.rb
spina-2.8.1 app/serializers/spina/api/image_serializer.rb
spina-2.8.0 app/serializers/spina/api/image_serializer.rb
spina-2.7.0 app/serializers/spina/api/image_serializer.rb
spina-2.6.2 app/serializers/spina/api/image_serializer.rb
spina-2.6.1 app/serializers/spina/api/image_serializer.rb
spina-2.6.0 app/serializers/spina/api/image_serializer.rb
spina-2.5.0 app/serializers/spina/api/image_serializer.rb
spina-2.4.0 app/serializers/spina/api/image_serializer.rb
spina-2.3.5 app/serializers/spina/api/image_serializer.rb
spina-2.3.4 app/serializers/spina/api/image_serializer.rb
spina-2.3.3 app/serializers/spina/api/image_serializer.rb
spina-2.3.2 app/serializers/spina/api/image_serializer.rb
spina-2.3.1 app/serializers/spina/api/image_serializer.rb
spina-2.3.0 app/serializers/spina/api/image_serializer.rb