app/controllers/spotlight/catalog_controller.rb
def make_canvases(ids_array)
      new_array = []
      ids_array.each do |doc_id|
        _,document = fetch doc_id
        # .iiif_manifest_json was in the Spotlight gem version of the catalog#manifest action.
        # It takes a SolrDocument and returns a .json version of the manifest containing 1 image/canvas.
        source_m = Spotlight::IiifManifestPresenter.new(document, self).iiif_manifest_json
        source_m = IIIF::Service.parse(JSON.parse(source_m))
        canvas = source_m.sequences.first.canvases.first
        resource = canvas.images.first.resource
        # Label each canvas with the manifest label if there is one
        canvas.label = source_m.label if source_m.label
        # Change widths and heights to integers so manifest will be valid
        results = dimensions_to_i(canvas, resource)
        canvas = results[0]
        resource = results[1]
        new_array.push(canvas)
      end
      new_array.each do |canvas|
        if canvas.label.nil?
          assigned_label = (new_array.index(canvas) + 1).to_s
          canvas.label = assigned_label
        end
      end
      return new_array
    end
# Makes canvases for subsequent images in a compound object. Returns an array of canvas objects.
Makes canvases for subsequent images in a compound object. Returns an array of canvas objects.
Makes canvases for subsequent images in a compound object . Returns an array of canvas objects .
def make_canvases(ids_array)
      new_array = []
      ids_array.each do |doc_id|
        _,document = fetch doc_id
        source_m = Spotlight::IiifManifestPresenter.new(document, self).iiif_manifest_json
        source_m = IIIF::Service.parse(JSON.parse(source_m))
        canvas = source_m.sequences.first.canvases.first
        resource = canvas.images.first.resource
        canvas.label = source_m.label if source_m.label
        results = dimensions_to_i(canvas, resource)
        canvas = results[0]
        resource = results[1]
        new_array.push(canvas)
      end
      new_array.each do |canvas|
        if canvas.label.nil?
          assigned_label = (new_array.index(canvas) + 1).to_s
          canvas.label = assigned_label
        end
      end
      return new_array
    end
def make_canvases ( ids_array ) new_array = [ ] ids_array . each do | doc_id | _ , document = fetch doc_id source_m = Spotlight :: IiifManifestPresenter . new ( document , self ) . iiif_manifest_json source_m = IIIF :: Service . parse ( JSON . parse ( source_m ) ) canvas = source_m . sequences . first . canvases . first resource = canvas . images . first . resource canvas . label = source_m . label if source_m . label results = dimensions_to_i ( canvas , resource ) canvas = results [ 0 ] resource = results [ 1 ] new_array . push ( canvas ) end new_array . each do | canvas | if canvas . label . nil? assigned_label = ( new_array . index ( canvas ) + 1 ) . to_s canvas . label = assigned_label end end return new_array end
Makes canvases for subsequent images in a compound object.
Makes canvases for subsequent images in a compound object .
# .iiif_manifest_json was in the Spotlight gem version of the catalog#manifest action. # It takes a SolrDocument and returns a .json version of the manifest containing 1 image/canvas. # Label each canvas with the manifest label if there is one # Change widths and heights to integers so manifest will be valid
ids_array