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