Skip to content

Commit

Permalink
Switch image requests to Hyacinth image proxy endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
elohanlon committed Feb 21, 2024
1 parent 211065c commit e21d112
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ Hyacinth.DigitalObjectsApp.DigitalObject.Asset.prototype.getOriginalFilePath = f
};

Hyacinth.DigitalObjectsApp.DigitalObject.Asset.prototype.hasImage = function () {
return Hyacinth.imageServerUrl && this.getDcType() == 'StillImage';
return Hyacinth.imageServerProxyPath && this.getDcType() == 'StillImage';
};

Hyacinth.DigitalObjectsApp.DigitalObject.Asset.prototype.isRestrictedSizeImage = function () {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Hyacinth.DigitalObjectsApp.DigitalObject.Base.getImageUrl = function (pid, type,
if (type == 'scaled') { type = 'full'; }
if (type == 'square') { type = 'featured'; }

return Hyacinth.imageServerUrl + '/iiif/2/standard/' + pid + '/' + type + '/!' + size + ',' + size + '/0/default.jpg';
return Hyacinth.imageServerProxyPath + '/iiif/2/standard/' + pid + '/' + type + '/!' + size + ',' + size + '/0/default.jpg';
};

Hyacinth.DigitalObjectsApp.DigitalObject.Base.showMediaViewModal = function (pid) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ Hyacinth.DigitalObjectsApp.DigitalObject.Item = function(digital_object_data){
Hyacinth.extendClass(Hyacinth.DigitalObjectsApp.DigitalObject.Item, Hyacinth.DigitalObjectsApp.DigitalObject.Base); //Extend

Hyacinth.DigitalObjectsApp.DigitalObject.Item.prototype.hasImage = function (){
return Hyacinth.imageServerUrl && this.ordered_child_digital_object_pids.length > 0;
return Hyacinth.imageServerProxyPath && this.ordered_child_digital_object_pids.length > 0;
};
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,9 @@ Hyacinth.DigitalObjectsApp.DigitalObjectSearchResult.prototype.getImageUrl = fun
if(type == 'square') { type = 'featured'; }

if(this.getHyacinthType() == 'asset') {
return Hyacinth.imageServerUrl + '/iiif/2/standard/' + this.getPid() + '/' + type + '/!' + size + ',' + size + '/0/default.jpg';
return Hyacinth.imageServerProxyPath + '/iiif/2/standard/' + this.getPid() + '/' + type + '/!' + size + ',' + size + '/0/default.jpg';
} else if (this.getHyacinthType() == 'item' && this.getOrderedChildDigitalObjectPids().length > 0) {
return Hyacinth.imageServerUrl + '/iiif/2/standard/' + this.getOrderedChildDigitalObjectPids()[0] + '/' + type + '/!' + size + ',' + size + '/0/default.jpg';
return Hyacinth.imageServerProxyPath + '/iiif/2/standard/' + this.getOrderedChildDigitalObjectPids()[0] + '/' + type + '/!' + size + ',' + size + '/0/default.jpg';
} else {
return null;
}
Expand Down
1 change: 1 addition & 0 deletions app/assets/javascripts/general/hyacinth.js.erb
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ Hyacinth.unexpectedAjaxErrorMessage = 'An unexpected error occurred while connec
<% else %>
Hyacinth.imageServerUrl = null;
<% end %>
Hyacinth.imageServerProxyPath = '/image_proxy';

//Hyacinth.AssignmentTaskTypes = <%#= Assignment.tasks.keys.map{|task| [task, task] }.to_h.to_json %>;

Expand Down
2 changes: 1 addition & 1 deletion app/views/digital_objects/media_view.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<script>
$(document).ready(function(){
var tileSources = [Hyacinth.imageServerUrl + "/iiif/2/standard/<%= @digital_object.pid %>/info.json"];
var tileSources = [Hyacinth.imageServerProxyPath + "/iiif/2/standard/<%= @digital_object.pid %>/info.json"];

var initialPage = 0;

Expand Down

0 comments on commit e21d112

Please sign in to comment.