Sha256: d0bee64be3bd22c17ac78f2b857ee8d61ca1940b4529b683ca65454f516cb507

Contents?: true

Size: 1.01 KB

Versions: 8

Compression:

Stored size: 1.01 KB

Contents

# frozen_string_literal: true

module GeoblacklightSidecarImages
  class ImageService
    module Wms
      ##
      # Formats and returns a thumbnail url from a Web Map Service endpoint.
      # This utilizes the GeoServer specific 'reflect' service to generate
      # parameters like bbox that are difficult to tweak without more detailed
      # information about the layer.
      # @param [SolrDocument]
      # @param [Integer] thumbnail size
      # @return [String] wms thumbnail url
      def self.image_url(document, size)
        # Swap proxy url with princeton geoserver url.
        # Thumbnail requests send geoserver auth.
        endpoint = document.viewer_endpoint.gsub(Settings.PROXY_GEOSERVER_URL,
                                                 Settings.INSTITUTION_GEOSERVER_URL)
        "#{endpoint}/reflect?" \
          '&FORMAT=image%2Fpng' \
          '&TRANSPARENT=TRUE' \
          "&LAYERS=#{document['layer_id_s']}" \
          "&WIDTH=#{size}" \
          "&HEIGHT=#{size}"
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
geoblacklight_sidecar_images-0.8.1 app/services/geoblacklight_sidecar_images/image_service/wms.rb
geoblacklight_sidecar_images-0.8.0 app/services/geoblacklight_sidecar_images/image_service/wms.rb
geoblacklight_sidecar_images-0.7.0 app/services/geoblacklight_sidecar_images/image_service/wms.rb
geoblacklight_sidecar_images-0.6.5 app/services/geoblacklight_sidecar_images/image_service/wms.rb
geoblacklight_sidecar_images-0.6.4 app/services/geoblacklight_sidecar_images/image_service/wms.rb
geoblacklight_sidecar_images-0.6.2 app/services/geoblacklight_sidecar_images/image_service/wms.rb
geoblacklight_sidecar_images-0.6.1 app/services/geoblacklight_sidecar_images/image_service/wms.rb
geoblacklight_sidecar_images-0.6.0 app/services/geoblacklight_sidecar_images/image_service/wms.rb