fixes #2680
This commit is contained in:
@@ -13,7 +13,12 @@ Upload.initialize_all = function() {
|
|||||||
if ($("#image").prop("complete")) {
|
if ($("#image").prop("complete")) {
|
||||||
this.initialize_image();
|
this.initialize_image();
|
||||||
} else {
|
} else {
|
||||||
$("#image").on("load.danbooru error.danbooru", this.initialize_image);
|
$("#image").on("error.danbooru", (e) => {
|
||||||
|
$("#upload-image").hide();
|
||||||
|
$("#scale-link").hide();
|
||||||
|
$("#iqdb-similar").hide();
|
||||||
|
});
|
||||||
|
$("#image").on("load.danbooru", this.initialize_image);
|
||||||
}
|
}
|
||||||
this.initialize_similar();
|
this.initialize_similar();
|
||||||
this.initialize_submit();
|
this.initialize_submit();
|
||||||
@@ -106,10 +111,10 @@ Upload.initialize_image = function() {
|
|||||||
var width = $image.width();
|
var width = $image.width();
|
||||||
var height = $image.height();
|
var height = $image.height();
|
||||||
if (!width || !height) {
|
if (!width || !height) {
|
||||||
// try again later
|
// we errored out
|
||||||
$.timeout(100).done(function() {Upload.initialize_image()});
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
$("#no-image-available").hide();
|
||||||
$image.data("original-width", width);
|
$image.data("original-width", width);
|
||||||
$image.data("original-height", height);
|
$image.data("original-height", height);
|
||||||
Post.resize_image_to_window($image);
|
Post.resize_image_to_window($image);
|
||||||
|
|||||||
@@ -1,11 +1,15 @@
|
|||||||
<% if params[:url] %>
|
<% if params[:url] %>
|
||||||
<% if ImageProxy.needs_proxy?(@source.image_url) %>
|
<div id="upload-image">
|
||||||
<%= image_tag(image_proxy_uploads_path(:url => @source.image_url), :title => "Preview", :id => "image") %>
|
<% if ImageProxy.needs_proxy?(@source.image_url) %>
|
||||||
<% elsif @source.image_url.present? %>
|
<%= image_tag(image_proxy_uploads_path(:url => @source.image_url), :title => "Preview", :id => "image") %>
|
||||||
<%= image_tag(@source.image_url, :title => "Preview", :id => "image") %>
|
<% elsif @source.image_url.present? %>
|
||||||
<% end %>
|
<%= image_tag(@source.image_url, :title => "Preview", :id => "image") %>
|
||||||
|
<% end %>
|
||||||
|
</div>
|
||||||
|
|
||||||
<ul id="upload-image-metadata">
|
<ul id="upload-image-metadata">
|
||||||
|
<li id="no-image-available"><em>No image preview available</em></li>
|
||||||
|
|
||||||
<% if @remote_size %>
|
<% if @remote_size %>
|
||||||
<li><strong>Size:</strong> <%= number_to_human_size(@remote_size) %></li>
|
<li><strong>Size:</strong> <%= number_to_human_size(@remote_size) %></li>
|
||||||
<% end %>
|
<% end %>
|
||||||
@@ -14,6 +18,6 @@
|
|||||||
<li><strong>Referrer:</strong> <%= params[:ref] %></li>
|
<li><strong>Referrer:</strong> <%= params[:ref] %></li>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<li><span id="scale"></span> (<%= link_to "toggle size", "#", :id => "image-resize-to-window-link" %>)</li>
|
<li id="scale-link"><span id="scale"></span> (<%= link_to "toggle size", "#", :id => "image-resize-to-window-link" %>)</li>
|
||||||
</ul>
|
</ul>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|||||||
Reference in New Issue
Block a user