问题是当这个页面加载时...它会拉动.jpg图像,因为该扩展名是硬编码的(注意_image1.jpg)有时候可能没有.jpg图像并且有.png图像。我想最初拉.jpg图像,但如果没有,我想要.png图像......我怎么能这样做?我想知道如果.jpg图像不可用,是否有办法重写扩展名。
$(document).ready(function() {
dealers = $.parseJSON(dealer_json);
$('#productdealersTable .productdealers_dealerid').each(function(i, element) {
var elemName = $(this).attr("name");
var elemValue = $(this).val();
var count = elemName.substring(23, elemName.length);
elemName = elemName.replace('productdealers_dealerid','dealerid_display_value');
$('#'+elemName).html($(this).find('option:selected').html());
var name = $(this).find('option:selected').html();
var cleanedname = name.replace(/[^a-z0-9]/gi,'');
$(this).parent().removeClass().addClass('fieldinput '+cleanedname).addClass();
var elemValue = $(this).val();
jQuery('#dealerid_display_value'+count).html('<img src="/folder-Files/dealerLogos/'+elemValue+'_image1.jpg" />');
var linkDiv = $(this).parent().find('.snapshotLink');
var mpDiv = $(this).parents('.half').find('.marketplace_div');
$.each(dealers.dealers, function(i, item) {
if (dealers.dealers[i].id==elemValue) {
dealers.dealers[i].show_in_pims == true ? linkDiv.show() : linkDiv.hide();
dealers.dealers[i].sc == true ? mpDiv.show() : mpDiv.hide();
if (dealers.dealers[i].scraped == 1) {
$('#dealers_scraped'+count).val(dealers.dealers[i].scraped);
}
return false;
}
});
});
<div class="productdealersItemHeader">
<h3><span class="h3pad"><a href="javascript:void(0);" class="quickRetailersShowHide" id="quickRetailerOptionShowHide%count%" onclick="showQuickRetailerOptions(%count%);"><span class="dealerid_display_value" id="dealerid_display_value%count%"><img src="/Portal-Files/dealerLogos/%productdealers_dealerid_selectedValue%_image1.jpg"/></span></a></span></h3>
<div class="dealerHandle productdealersActive"></div>
<a href="javascript:void(0);" class="deleteRetailerLink deleteRowButton productdealersActive" id="productdealersDeleteImg%count%" onclick="deleteListRow('productdealers', '%count%');">Delete</a>
</div>
答案 0 :(得分:1)
您可以针对该图片发出简单请求 - 如果可用,请使用它,否则请查找png格式。
with tf.variable_scope(layer_name) as s:
h1 = tf.contrib.layers.convolution2d(inputs = x1, num_outputs = 10, kernel_size = [3, 3], stride = [1, 1], padding = 'VALID', scope = s)
h2 = tf.contrib.layers.convolution2d(inputs = x2, num_outputs = 10, kernel_size = [3, 3], stride = [1, 1], padding = 'VALID', reuse = True, scope = s)