function add_new_artistimg(){
var _count = $(".artist_image input[type=file]").length;
if (_count < 6)
{
var html = '
';
html += '
';
html += '
';
html += '
';
html += '
';
$(".artist_image").append(html);
}
else
alert("アーティスト写真を最大6まで2。");
}
function set_image_to(artist_image){
var fd = new FormData();
if ($("#"+artist_image).val() !== '') {
fd.append( "file", $("#"+artist_image).prop("files")[0] );
}
fd.append( "action","add_new_image");
var postData = {
url : ajaxurl,
type : "POST",
dataType : "text",
data : fd,
processData : false,
contentType : false,
success: function( response ){
var default_img = "https://marvelous-arc.com/wp-content/themes/s_customify/data/img/20160910_photo.svg";
if (response == "over_3MB_IMAGE"){
$("#"+artist_image+"_hidden").val("");
$("#"+artist_image+"_img").attr("src",default_img);
alert("1ファイル3MB以下、合計で最大10MB以下のファイルサイズに収めてください。");
}
else{
$("#"+artist_image+"_hidden").val(response);
if (response == "")
$("#"+artist_image+"_img").attr("src",default_img);
else
$("#"+artist_image+"_img").attr("src",response);
}
},
error: function(response){
console.log("error");
console.log(response);
}
};
$.ajax(
ajaxurl, postData
).done(function( text ){
//console.log(text);
});
}