
cheditor5 에디터 사용 중에
오른쪽 상단에 사진 추가 버튼이 플래시로 되어있어서 사진 추가가 안 되는 현상..
그누보드나 에디터 버전 변경할 시간이 없어서 플래시만 떼어내기로 했다.
/cheditor5/popup/image.html 변경 전
<head>
<meta name="robots" content="noindex, nofollow" />
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<link rel="stylesheet" type="text/css" href="../css/imageUpload.css" />
<script src="js/dialog.js" type="text/javascript"></script>
<script src="js/image.js" type="text/javascript"></script>
<script src="js/image_upload_flash.js" type="text/javascript"></script>
<script type="text/javascript">
</script>
</head>
<body scroll="no">
<div id="uploadWindow">
<div id="container">
<div style="float:left;margin-top:4px;font-size:8pt;font-family:dottum;color:#666">
<img src="../icons/imageUpload/mouse_drag_img.gif" width="19" height="16" alt="" style="vertical-align:middle" />
마우스로 드래그하여 순서를 바꾸세요. (<b><span id="imageCount">0</span></b>장 / 12장 사진)
</div>
<div style="float:right;margin:0px 0px 7px 0px">
<table border="0" cellpadding="0" cellspacing="0">
<tr>
<td id="oFlash"></td>
<td><img src="../icons/imageUpload/remove_all.gif" class="button" style="margin-left:3px;vertical-align:middle" onclick="removeImage()" alt="" /></td>
</tr>
</table>
</div>
/cheditor5/popup/image.html 변경 후
(image.js 파일에 함수를 올리라고 하는데 세팅 문제인지 함수를 찾을 수가 없다고 떠서 image.html 파일에 넣었다.)
<head>
<meta name="robots" content="noindex, nofollow" />
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<link rel="stylesheet" type="text/css" href="../css/imageUpload.css" />
<script src="js/dialog.js" type="text/javascript"></script>
<script src="js/image.js" type="text/javascript"></script>
<script src="//code.jquery.com/jquery-1.12.4.min.js" type="text/javascript"></script>
<script src="js/dialog.js" type="text/javascript"></script>
<!--
<script src="js/image_upload_flash.js" type="text/javascript"></script>
-->
<script type="text/javascript">
function noFlashUploadOpen() {
$("#nfile").click(); // 숨김 input file를 클릭하는 효과
}
function noFlashUpload() {
console.log("?");
var uplist = $("#nfile").get(0).files; // 숨김 input file에서 파일 배열을 가져옴
if(uplist.length < 1) return; // 첨부없으면 끝
for(var i = 0; i < uplist.length; i++) {
// 각 파일의 형식 제한
if(uplist[i].type != "image/png" && uplist[i].type != "image/gif" && uplist[i].type != "image/jpg" && uplist[i].type != "image/jpeg") {
fileFilterError(uplist[i].name);
return;
}
}
// 업로드 시작 알림(로더)
startUpload(uplist.length); // image.js
// 업로드 작업
// cheditor5/imageUpload/upload.php 에서 1개씩만 업로드를 처리하므로 개별처리
// 순차 처리를 위해서 ajax의 비동기를 끔 async: false
// 업로드 진행율이 필요없으므로 xhr 은 제외
for(var i = 0; i < uplist.length; i++) {
var formData = new FormData();
formData.append("file", uplist[i]);
$.ajax( {
url: UploadScript,
type: "POST",
contentType: false,
processData: false,
crossDomain: true,
cache: false,
async: false,
dataType: "text", // 여기 본인 상황에 맞게
data: formData,
success: function(response, textStatus, xhr) {
uploadComplete(response);
},
error: function(xhr, textStatus, error) {
console.log(xhr.responseText);
}
});
}
}
</script>
</head>
<body scroll="no">
<div id="uploadWindow">
<div id="container">
<div style="float:left;margin-top:4px;font-size:8pt;font-family:dottum;color:#666">
<img src="../icons/imageUpload/mouse_drag_img.gif" width="19" height="16" alt="" style="vertical-align:middle" />
마우스로 드래그하여 순서를 바꾸세요. (<b><span id="imageCount">0</span></b>장 / 12장 사진)
</div>
<div style="float:right;margin:0px 0px 7px 0px">
<table border="0" cellpadding="0" cellspacing="0">
<tr>
<td id="oFlash">
<input type="file" id="nfile" name="nfile" multiple="multiple" accept=".gif,.jpg,.jpeg,.png" style="display:none" onchange="noFlashUpload()"/>
<img src="../icons/imageUpload/add_image_button.gif" style="margin-left:3px;vertical-align:middle;cursor:pointer" onclick="noFlashUploadOpen()" alt="" />
</td>
<td><img src="../icons/imageUpload/remove_all.gif" class="button" style="margin-left:3px;vertical-align:middle" onclick="removeImage()" alt="" /></td>
</tr>
</table>
</div>
/cheditor5/popup/js/image.js 에 추가
function noFlashUploadOpen() {
$("#nfile").click(); // 숨김 input file를 클릭하는 효과
}
function noFlashUpload() {
var uplist = $("#nfile").get(0).files; // 숨김 input file에서 파일 배열을 가져옴
if(uplist.length < 1) return; // 첨부없으면 끝
for(var i = 0; i < uplist.length; i++) {
// 각 파일의 형식 제한
if(uplist[i].type != "image/png" && uplist[i].type != "image/gif" && uplist[i].type != "image/jpg" && uplist[i].type != "image/jpeg") {
fileFilterError(uplist[i].name);
return;
}
}
// 업로드 시작 알림(로더)
startUpload(uplist.length); // image.js
// 업로드 작업
// cheditor5/imageUpload/upload.php 에서 1개씩만 업로드를 처리하므로 개별처리
// 순차 처리를 위해서 ajax의 비동기를 끔 async: false
// 업로드 진행율이 필요없으므로 xhr 은 제외
for(var i = 0; i < uplist.length; i++) {
var formData = new FormData();
formData.append("file", uplist[i]);
$.ajax( {
url: UploadScript,
type: "POST",
contentType: false,
processData: false,
crossDomain: true,
cache: false,
async: false,
dataType: "text", // 여기 본인 상황에 맞게
data: formData,
success: function(response, textStatus, xhr) {
uploadComplete(response);
},
error: function(xhr, textStatus, error) {
console.log(xhr.responseText);
}
});
}
}
참조글
그누보드4의 cheditor5 플래시를 ajax로 > SIR
여러 버전이 있고, 또 뭔가 좀 안맞는 구석도 있고 해서 다시 정리해서 올립니다.
복붙하지 마시고 본인의 에디터를 살펴보고 적당히 수정해서 넣으세요.
1) 플래시 버튼을
sir.kr
글 올려주신 분께 압도적 감사 ㅠㅠㅠ
빨리 해결하려고 덕지덕지 붙인 소스라 꼭 참조 글을 확인하길...!
또 이런 일이 있을까 봐 글 남겨둔다..

반응형
'개발하는 '정' > 기타' 카테고리의 다른 글
[html] SELECT 박스 READONLY 처리 (0) | 2022.09.02 |
---|---|
[오류 해결] 파일이나 어셈블리 중 하나를 로드할 수 없습니다. 현재 로드한 런타임보다 최신 런타임으로 어셈블리를 빌드했으므로 어셈블리를 로드할 수 없습니다. (0) | 2021.04.16 |
HTTP -> HTTPS 자동 강제 전환 / 그누보드 https 리다이렉트 하는 방법 3가지 (1) | 2020.12.24 |
SSH Secure Shell 접속 연결 방법 + Profiles 추가 방법 (1) | 2020.12.20 |
윈도우10에서 telnet 실행하는 방법 (2) | 2020.12.19 |
댓글