cheditor 5.1.9.4 버전 업데이트

This commit is contained in:
kir rio
2023-01-11 10:21:44 +09:00
parent 7516424989
commit d99641d122
12 changed files with 335 additions and 187 deletions

View File

@ -1,9 +1,9 @@
// ================================================================
// CHEditor 5.1.9.3-p4
// CHEditor 5.1.9.4
// ----------------------------------------------------------------
// Homepage: http://www.chcode.com
// EMail: support@chcode.com
// Copyright (c) 1997-2020 CHSOFT
// Copyright (c) 1997-2021 CHSOFT
// ================================================================
var GB = {
colors: ['#000000','#313131','#434343','#535353','#666666','#999999','#a0a0a0','#b5b5b5','#c0c0c0','#dcdcdc','#eeeeee','#ffffff',
@ -568,6 +568,7 @@ function setConfig() {
this.cheditor.tabSpaces = '';
this.cheditor.modifyState = false;
this.cheditor.tabSpaces = new Array(this.config.tabIndent + 1).join(' ');
// this.URI = URI;
}
function cheditor() {

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

View File

@ -1,15 +1,15 @@
<?php
include_once("_common.php");
define("CHE_UPLOAD_IMG_CHECK", 1); // <EFBFBD>̹<EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>Ҽ<EFBFBD> <20>ִ<EFBFBD><D6B4><EFBFBD> <20><><EFBFBD>θ<EFBFBD> üũ<C3BC>մϴ<D5B4>. ( <20>ش<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>̹<EFBFBD><CCB9><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> üũ<C3BC>մϴ<D5B4>. 1<≯<EFBFBD> <20><><EFBFBD><EFBFBD>, 0<≯<EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> )
define("CHE_UPLOAD_IMG_CHECK", 1); // 이미지 파일을 썸네일 할수 있는지 여부를 체크합니다. ( 해당 파일이 이미지 파일인지 체크합니다. 1이면 사용, 0이면 사용 안함 )
// ---------------------------------------------------------------------------
# <EFBFBD>̹<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E4B8AE> <20><>ü <20><><EFBFBD>θ<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>մϴ<D5B4>.
# <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>(/)<29><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>ʽ<EFBFBD><CABD>ϴ<EFBFBD>.
# <EFBFBD><EFBFBD><EFBFBD><EFBFBD>: <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>, <20>б<20><><EFBFBD><EFBFBD><EFBFBD>ϵ<EFBFBD><CFB5><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>ֽʽÿ<CABD>.
# 이미지가 저장될 디렉토리의 전체 경로를 설정합니다.
# 끝에 슬래쉬(/)는 붙이지 않습니다.
# 주의: 이 경로의 접근 권한은 쓰기, 읽기가 가능하도록 설정해 주십시오.
# data/editor <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E4B8AE> <20><><EFBFBD><EFBFBD><EFBFBD>ϴ<EFBFBD> <20>ڵ带 <20>߰<EFBFBD><DFB0><EFBFBD>. kagla 140305
# data/editor 디렉토리가 없는 경우가 있을수 있으므로 디렉토리를 생성하는 코드를 추가함. kagla 140305
@mkdir(G5_DATA_PATH.'/'.G5_EDITOR_DIR, G5_DIR_PERMISSION);
@chmod(G5_DATA_PATH.'/'.G5_EDITOR_DIR, G5_DIR_PERMISSION);
@ -24,8 +24,8 @@ define("SAVE_DIR", $data_dir);
@mkdir(SAVE_DIR, G5_DIR_PERMISSION);
@chmod(SAVE_DIR, G5_DIR_PERMISSION);
# <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 'SAVE_DIR'<EFBFBD><EFBFBD> URL<EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>մϴ<D5B4>.
# <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>(/)<29><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>ʽ<EFBFBD><CABD>ϴ<EFBFBD>.
# 위에서 설정한 'SAVE_DIR' URL을 설정합니다.
# 끝에 슬래쉬(/)는 붙이지 않습니다.
define("SAVE_URL", $data_url);

View File

@ -93,9 +93,9 @@ if ($found != true || $filename_len != 23) {
exit;
}
// <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20≯<EFBFBD>: <20><><EFBFBD><EFBFBD><EFBFBD>Ͻú<CFBD><C3BA><EFBFBD>_<EFBFBD><5F><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>8<EFBFBD><38>
// 저장 파일 이름: 년월일시분초_렌덤문자8자
// 20140327125959_abcdefghi.jpg
// <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20≯<EFBFBD>: $_POST["origname"]
// 원본 파일 이름: $_POST["origname"]
$filename = che_replace_filename($filename);
$savefile = SAVE_DIR . '/' . $filename;

View File

@ -1,9 +1,9 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<!DOCTYPE html>
<html lang="ko">
<head>
<title>CHEditor</title>
<meta name="robots" content="noindex, nofollow" />
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<link rel="stylesheet" type="text/css" href="../css/dialog.css" />
<script src="js/dialog.js" type="text/javascript"></script>
<script src="js/flash.js" type="text/javascript"></script>
@ -11,12 +11,12 @@
<body>
<div class="flash-movie-source">
<div style="margin-bottom: 10px;width: 562px">
<span class="font-normal">&lt;동영상 소스 코드&gt; iframe 또는 object 태그를 입력하세요.</span>
<span class="font-normal">동영상 링크 URL 또는 IFRAME이나 EMBED 소스 코드를 붙여 넣거나 입력하세요.</span>
</div>
<textarea name="embed" id="fm_embed" style="height:40px;width:99%"></textarea>
<textarea name="source" id="fm_source" style="height:40px;width:99%"></textarea>
</div>
<div class="spacer"></div>
<div class="flash-player-wrapper" id="fm_player"></div>
<div class="bottom-status" id="buttonWrapper"></div>
</body>
</html>
</html>

View File

@ -6,13 +6,13 @@
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" type="text/css" href="../css/dialog.css" />
<script src="js/dialog.js" type="text/javascript"></script>
<script src="https://maps.google.com/maps/api/js?V=3&language=ko&region=KR" type="text/javascript"></script>
<script src="https://maps.google.com/maps/api/js?V=3&language=ko&region=KR&key=JS_MAPS_API_KEY" type="text/javascript"></script>
<script src="js/google_map.js" type="text/javascript"></script>
</head>
<body onload="initMap(5)">
<div style="padding-left:10px">
<span class="font-normal">찾을 주소: </span>
<input type="text" name="address" id="fm_address" value="서울" />
<input type="text" name="address" id="fm_address" title="찾을 주소" value="서울" />
<span id="map_search"></span>
<div class="font-normal" style="margin: 5px 0px 0px 58px;color:#666">찾으실 도로명 주소, 지번 또는 건물명을 입력하세요.</div>
</div>

View File

@ -64,6 +64,7 @@
<div style="margin-top:5px;font-size: 12px">
<input type="checkbox" name="use_spacer" value="1" checked="checked" />사진 여백 넣기
</div>
<div id="webgl_logo_wrapper" class="webgl_logo_wrapper" style="text-align: center;"></div>
</form>
</div>
</div>

View File

@ -1,5 +1,5 @@
// ================================================================
// CHEditor 5
// Movie
// ================================================================
var button = [
{ alt : '', img : 'play.gif', cmd : doPlay },
@ -7,7 +7,10 @@ var button = [
{ alt : '', img : 'cancel.gif', cmd : popupClose }
],
oEditor = null,
iframeSource = false;
iframeSource = null,
showMovie = false,
defaultMovieWidth = 640,
defaultMovieHeight = 360;
function init(dialog) {
var dlg = new Dialog(this);
@ -17,52 +20,65 @@ function init(dialog) {
dlg.setDialogHeight();
}
function doPlay()
{
var elem = oEditor.trimSpace(document.getElementById("fm_embed").value),
embed = null, div = document.createElement('div'),
pos, str, object, child, movieHeight, movieWidth, i, params = [];
function getSource() {
return oEditor.trimSpace(document.getElementById("fm_source").value);
}
elem = oEditor.trimSpace(elem);
if (elem == '') {
function doPlay() {
var embed = null,
div = document.createElement('div'),
pos, str, object, child, movieHeight, movieWidth, params = [], showWrapper,
source = getSource(), iframe;
showMovie = true;
if (source === '') {
return;
}
if (elem.toLowerCase().indexOf("iframe") !== -1) {
document.getElementById('fm_player').innerHTML = elem;
iframeSource = true;
showWrapper = document.getElementById('fm_player');
if (source.toLowerCase().indexOf("iframe") !== -1) {
showWrapper.innerHTML = source;
iframeSource = source;
return;
}
pos = elem.toLowerCase().indexOf("embed");
if (/https?:\/\//.test(source)) {
iframe = createIframeElement(defaultMovieWidth, defaultMovieHeight, source);
if (iframe) {
showWrapper.innerHTML = '';
showWrapper.appendChild(iframe);
iframeSource = iframe;
}
return;
}
pos = source.toLowerCase().indexOf("embed");
if (pos !== -1) {
str = elem.substr(pos);
str = source.substr(pos);
pos = str.indexOf(">");
div.innerHTML = "<" + str.substr(0, pos) + ">";
embed = div.firstChild;
} else {
div.innerHTML = elem;
div.innerHTML = source;
object = div.getElementsByTagName('OBJECT')[0];
if (object && object.hasChildNodes()) {
child = object.firstChild;
movieWidth = (isNaN(object.width) !== true) ? object.width : 320;
movieHeight = (isNaN(object.height) !== true) ? object.height : 240;
movieWidth = (isNaN(object.width) !== true) ? object.width : defaultMovieWidth;
movieHeight = (isNaN(object.height) !== true) ? object.height : defaultMovieHeight;
do {
if ((child.nodeName === 'PARAM') && (typeof child.name !== 'undefined') && (typeof child.value !== 'undefined')) {
params.push({key: (child.name == 'movie') ? 'src' : child.name, val: child.value});
if (child.nodeName === 'PARAM' && typeof child.name !== 'undefined' && typeof child.value !== 'undefined')
{
params.push({
key: child.name === 'movie' ? 'src' : child.name,
val: child.value
});
}
child = child.nextSibling;
} while (child);
if (params.length > 0) {
embed = document.createElement('embed');
embed.setAttribute("width", movieWidth);
embed.setAttribute("height", movieHeight);
for (i = 0; i < params.length; i++) {
embed.setAttribute(params[i].key, params[i].val);
}
embed.setAttribute("type", "application/x-shockwave-flash");
embed = createEmbedElement(movieWidth, movieHeight, params, null);
}
}
}
@ -72,6 +88,89 @@ function doPlay()
}
}
function createIframeElement(width, height, src) {
var iframe = document.createElement('iframe'), uri, query, id, movie = null;
uri = new oEditor.URI(src);
if (uri.path && uri.path.charAt(0) !== '/') {
uri.path = '/' + uri.path;
}
switch (uri.authority) {
case 'youtu.be' :
case 'youtube.com':
case 'www.youtube.com':
if (uri.path === '/watch' && uri.query) {
query = uri.query.split('=');
if (query[0] === 'v') {
movie = '/' + query[1];
}
}
if (!movie && uri.path) {
movie = uri.path;
if (uri.query) {
movie += '?' + uri.query;
}
}
if (movie) {
movie = 'https://www.youtube.com/embed' + movie;
}
break;
case 'vimeo.com' :
if (uri.path) {
movie = 'https://player.vimeo.com/video' + uri.path;
}
break;
case 'afree.ca' :
if (uri.path) {
movie = 'http://play.afreecatv.com' + uri.path + '/embed';
}
break;
case 'tv.naver.com' :
if (uri.path) {
id = uri.path.substring(uri.path.lastIndexOf('/'));
movie = 'https://tv.naver.com/embed' + id + '?autoPlay=true';
}
break;
case 'tv.kakao.com' :
if (uri.path) {
id = uri.path.substring(uri.path.lastIndexOf('/'));
movie = 'https://tv.kakao.com/embed/player/cliplink' + id;
}
break;
default :
movie = null;
}
if (!movie) {
return null;
}
iframe.setAttribute('width', width);
iframe.setAttribute('height', height);
iframe.setAttribute('frameborder', "0");
iframe.setAttribute('allowfullscreen', "true");
iframe.setAttribute('src', movie);
return iframe;
}
function createEmbedElement(width, height, params, src) {
var embed = document.createElement('embed'), i;
embed.setAttribute("type", "application/x-shockwave-flash");
embed.setAttribute('width', width);
embed.setAttribute('height', height);
if (src) {
embed.setAttribute('src', src);
}
for (i = 0; i < params.length; i++) {
embed.setAttribute(params[i].key, params[i].val);
}
return embed;
}
function popupClose() {
document.getElementById('fm_player').innerHTML = '';
oEditor.popupWinCancel();
@ -79,13 +178,17 @@ function popupClose() {
function doSubmit()
{
var source = String(oEditor.trimSpace(document.getElementById("fm_embed").value));
var source = getSource();
if (source === '') {
popupClose();
}
if (!showMovie) {
document.getElementById('fm_player').style.visibility = 'hidden';
doPlay();
}
if (iframeSource || source.indexOf("iframe") !== -1) {
oEditor.insertHtmlPopup(source);
if (iframeSource) {
oEditor.insertHtmlPopup(iframeSource);
} else {
oEditor.insertFlash(source);
}
@ -93,3 +196,4 @@ function doSubmit()
document.getElementById('fm_player').innerHTML = '';
oEditor.popupWinClose();
}

View File

@ -13,7 +13,9 @@ var oEditor = null,
mapWidth = 512,
mapHeight = 320,
panorama,
panoramaVisible = false;
panoramaVisible = false,
marker,
staticMapsAPI = 'STATIC_MAPS_API_KEY';
function doSubmit() {
var mapImg = document.createElement("img"),
@ -29,10 +31,9 @@ function doSubmit() {
mapImg.style.width = mapWidth + 'px';
mapImg.style.height = mapHeight + 'px';
mapImg.style.border = '1px #000 solid';
mapImg.setAttribute("alt", "Google Map");
mapImg.setAttribute('alt', 'Google Map');
mapImg.onload = function () {
oEditor.insertHtmlPopup(mapImg);
oEditor.setImageEvent(true);
oEditor.popupWinClose();
};
@ -41,42 +42,46 @@ function doSubmit() {
panoramaHeading = panorama.getPov().heading;
panoramaZoom = panorama.getPov().zoom;
panoramaPosition = panorama.getPosition();
mapImg.src = "http://maps.googleapis.com/maps/api/streetview?location=" + panoramaPosition +
mapImg.src = "http://maps.googleapis.com/maps/api/streetview?" +
"location=" + panoramaPosition.lat() + ',' + panoramaPosition.lng() +
"&pitch=" + panoramaPitch +
"&heading=" + panoramaHeading +
"&size=" + mapWidth + 'x' + mapHeight +
"&zoom=" + panoramaZoom +
"&sensor=false" +
"&region=KR";
"&region=KR" +
"&key=" + staticMapsAPI;
} else {
mapImg.src = "http://maps.google.com/maps/api/staticmap?center=" + centerLat + ',' + centerLng +
mapImg.src = "http://maps.google.com/maps/api/staticmap?" +
"center=" + centerLat + ',' + centerLng +
"&zoom=" + setZoom +
"&size=" + mapWidth + 'x' + mapHeight +
"&maptype=" + mapType +
//"&markers=" + marker_lat + ',' + marker_lng +
"&markers=" + marker_lat + ',' + marker_lng +
"&sensor=false" +
"&language=ko" +
"&region=KR";
"&region=KR" +
"&key=" + staticMapsAPI;
}
}
function searchAddress() {
var address = document.getElementById('fm_address').value,
geocoder = new google.maps.Geocoder();
//var results, status;
//var marker = new google.maps.Marker({ 'map': map, 'draggable': true });
geocoder.geocode({'address' : address},
function (results, status) {
if (status === google.maps.GeocoderStatus.OK) {
centerLat = results[0].geometry.location.lat();
centerLng = results[0].geometry.location.lng();
latlng = new google.maps.LatLng(centerLat, centerLng);
map.setCenter(latlng);
map.setZoom(setZoom);
}
});
function (results, status) {
if (status === google.maps.GeocoderStatus.OK) {
centerLat = results[0].geometry.location.lat();
centerLng = results[0].geometry.location.lng();
latlng = new google.maps.LatLng(centerLat, centerLng);
map.setCenter(latlng);
map.setZoom(setZoom);
marker = new google.maps.Marker({ 'map': map, 'draggable': true, 'position': latlng,
animation: google.maps.Animation.DROP});
marker.setMap(map);
}
});
}
function initMap(zoom) {

View File

@ -36,7 +36,8 @@ var activeImage = null,
uploadImagePath = '',
uploadMaxNumber = 12,
uploadScript,
useWebGL = false;
useWebGL = false,
supportImageOrientation;
if (ArrayBuffer && !ArrayBuffer.prototype.slice) {
ArrayBuffer.prototype.slice = function (start, end) {
@ -437,11 +438,6 @@ function fileFilterError(file) {
"gif, png, jpg, webp 사진 파일만 전송할 수 있습니다.");
}
function explorerFileFilterError(file) {
alert("선택하신 '" + file + "' 파일은 전송할 수 없습니다.\n" +
"익스플로러 환경에서는 gif, png, jpg 사진 파일만 \n전송할 수 있습니다.");
}
function imgComplete(img, imgSize, boxId) {
var resizeW, resizeH, M, elem;
img.setAttribute("border", '0');
@ -929,7 +925,7 @@ function DoUpload() {
blob = new Blob();
for (key in blob) {
if (blob.hasOwnProperty(key)) {
if ({}.hasOwnProperty.call(blob, key)) {
(function (key) {
Object.defineProperty(MYBLOB.prototype,
key,
@ -967,13 +963,7 @@ DoUpload.prototype = {
file = files[i];
if (!file.type.match(fileTypeRe)) {
// 엣지를 제외한 ie브라우저인지 체크
var agent = navigator.userAgent.toLowerCase();
if (agent.indexOf('trident') != -1 || agent.indexOf("msie") != -1) {
explorerFileFilterError(file.name);
} else {
FileFilterError(file.name);
}
fileFilterError(file.name);
continue;
}
this.list.push(file);
@ -1032,15 +1022,22 @@ DoUpload.prototype = {
offset = 2,
marker, little, tags, i;
// JPEG가 아닌 경우, 알 수 없음
if (view.getUint16(0, false) !== 0xffd8) {
return -2;
}
while (offset < length) {
// 알 수 없음
if (view.getUint16(offset + 2, false) <= 8) {
return -1;
}
marker = view.getUint16(offset, false);
offset += 2;
if (marker === 0xffe1) {
// 알 수 없음
if (view.getUint32(offset += 2, false) !== 0x45786966) {
return -1;
}
@ -1061,7 +1058,7 @@ DoUpload.prototype = {
offset += view.getUint16(offset, false);
}
}
// 알 수 없음
return -1;
},
@ -1076,7 +1073,7 @@ DoUpload.prototype = {
|| window.MSBlobBuilder;
if (e.name === 'TypeError' && window.BlobBuilder) {
blobb = new BlobBuilder();
// eslint-disable-next-line no-undef
blobb.append(data);
blob = blobb.getBlob(datatype);
console.log("TypeError");
@ -1089,50 +1086,46 @@ DoUpload.prototype = {
return blob;
},
imageResize : function (image, filetype, resizeWidth, orientation, addWaterMark) {
var canvas, source_w = image.width, source_h = image.height,
resize_h, resize_w, ratio_w, ratio_h, ratio_w_half, ratio_h_half,
imageResize : function (image, filetype, resize_w, orientation, addWaterMark) {
var canvas = document.createElement("canvas"),
ctx = canvas.getContext("2d"),
source_w = image.width,
source_h = image.height,
resize_h, ratio_w, ratio_h, ratio_w_half, ratio_h_half,
source_img, resize_img, source_data, resize_data, j, i,
x2, weight, weights, weights_alpha, gx_a, gx_b, gx_g, gx_r, center_x, center_y, x_start, x_stop,
y_start, y_stop, y, dy, part_w, x, dx, w, pos_x,
ctx, gl, imageData = null;
x2, weight, weights, weights_alpha, gx_a, gx_b, gx_g, gx_r,
center_x, center_y, x_start, x_stop,
y_start, y_stop, y, dy, part_w, x, dx, w, pos_x, gl, imageData = null;
// 카메라 로테이션 보정
if (orientation > 0) {
canvas = document.createElement("canvas");
canvas.width = source_w;
canvas.height = source_h;
ctx = canvas.getContext("2d");
ctx.clearRect(0, 0, canvas.width, canvas.height);
ctx.save();
if (orientation > 0 && !supportImageOrientation) {
if ([5,6,7,8].indexOf(orientation) > -1) {
canvas.width = source_h;
canvas.height = source_w;
} else {
canvas.width = source_w;
canvas.height = source_h;
}
switch (orientation) {
case 2 :
ctx.translate(-1, 0, 0, 1, canvas.width, 0); break;
case 3 :
ctx.translate(-1, 0, 0, -1, canvas.width, canvas.height); break;
case 4 :
ctx.translate(1, 0, 0, -1, 0, canvas.height); break;
case 5 :
ctx.translate(0, 1, 1, 0, 0, 0); break;
case 6 :
ctx.translate(0, 1, -1, 0, canvas.height, 0); break;
case 7 :
ctx.translate(0, -1, -1, 0, canvas.height, canvas.width); break;
case 8 :
ctx.translate(0, -1, 1, 0, 0, canvas.width); break;
case 2 : ctx.transform(-1, 0, 0, 1, source_w, 0); break;
case 3 : ctx.transform(-1, 0, 0, -1, source_w, source_h); break;
case 4 : ctx.transform(1, 0, 0, -1, 0, source_h); break;
case 5 : ctx.transform(0, 1, 1, 0, 0, 0); break;
case 6 : ctx.transform(0, 1, -1, 0, source_h, 0); break;
case 7 : ctx.transform(0, -1, -1, 0, source_h, source_w); break;
case 8 : ctx.transform(0, -1, 1, 0, 0, source_w); break;
default: break;
}
ctx.drawImage(image, 0, 0);
ctx.drawImage(image, 0, 0, source_w, source_h);
imageData = ctx.getImageData(0, 0, canvas.width, canvas.height);
ctx.restore();
source_w = canvas.width;
source_h = canvas.height;
}
if (source_w > resizeWidth) {
resize_w = resizeWidth;
if (source_w > resize_w) {
resize_h = Math.ceil(resize_w / source_w * source_h);
try {
@ -1143,8 +1136,6 @@ DoUpload.prototype = {
canvas = gl_canvas;
});
} catch (ignore) {
canvas = document.createElement("canvas");
ctx = canvas.getContext("2d");
canvas.width = source_w;
canvas.height = source_h;
@ -1216,14 +1207,10 @@ DoUpload.prototype = {
canvas.height = resize_h;
ctx.putImageData(resize_img, 0, 0);
}
} else {
canvas = document.createElement("canvas"),
canvas.width = source_w; canvas.height = source_h;
ctx = canvas.getContext("2d");
canvas.width = source_w;
canvas.height = source_h;
ctx.drawImage(image, 0, 0);
resize_h = source_h;
resize_w = source_w;
}
if (this.reader.watermark && addWaterMark) {
@ -1276,7 +1263,8 @@ DoUpload.prototype = {
filename = evt.target.file.name,
filetype = evt.target.file.type,
file = evt.target.file,
blob, image, orientation = 1, slice = 64 * 1024;
blob, image, orientation = 1,
slice = 64 * 1024;
if (slice > file.size - 1) {
slice = file.size;
@ -1298,12 +1286,12 @@ DoUpload.prototype = {
xhr.open('POST', uploadScript, true);
if (imageResizeWidth > 0) {
fileFormat = filename.substring(filename.lastIndexOf('.'));
if (imageResizeWidth > 0 && fileFormat !== '.gif') {
bitmapData = self.imageResize(this, filetype, imageResizeWidth, orientation, true);
file = self.canvasToBlob(bitmapData, filetype);
}
fileFormat = filename.substring(filename.lastIndexOf('.'));
randomName = self.makeFilename(fileFormat);
data.append('origname', filename);
@ -1375,7 +1363,6 @@ DoUpload.prototype = {
blob = null;
xhr.send(data);
};
image.src = blob.getURL();
}
},
@ -1484,7 +1471,7 @@ function setResizeWidth() {
}
function init(dialog) {
var dlg, i, elem, input, select, value, name, xhr_f, xhr_v, tmpcanvas, glicon;
var dlg, i, elem, input, select, value, name, xhr_f, xhr_v, tmpcanvas, glicon, testImg;
oEditor = this;
oEditor.dialog = dialog;
@ -1588,8 +1575,24 @@ function init(dialog) {
xhr_f.send();
xhr_v.send();
}
glicon = new Image();
glicon.className = 'webgl_logo';
glicon.src = uploadImagePath + (useWebGL ? "/webgl.png" : "/webgl-off.png");
document.getElementById('webgl_logo_wrapper').appendChild(glicon);
// 브라우저가 사진 Orientation 보정을 자동으로 지원하지는지 확인
testImg = new Image();
testImg.onload = function () {
supportImageOrientation = testImg.width === 2 && testImg.height === 3;
};
testImg.src =
'data:image/jpeg;base64,/9j/4QAiRXhpZgAATU0AKgAAAAgAAQESAAMAAAABAAYAAAA' +
'AAAD/2wCEAAEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBA' +
'QEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQE' +
'BAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAf/AABEIAAIAAwMBEQACEQEDEQH/x' +
'ABRAAEAAAAAAAAAAAAAAAAAAAAKEAEBAQADAQEAAAAAAAAAAAAGBQQDCAkCBwEBAAAAAAA' +
'AAAAAAAAAAAAAABEBAAAAAAAAAAAAAAAAAAAAAP/aAAwDAQACEQMRAD8AG8T9NfSMEVMhQ' +
'voP3fFiRZ+MTHDifa/95OFSZU5OzRzxkyejv8ciEfhSceSXGjS8eSdLnZc2HDm4M3BxcXw' +
'H/9k=';
}

View File

@ -35,8 +35,9 @@ var activeImage = null,
tmpTop = 0,
uploadImagePath = '',
uploadMaxNumber = 12,
uploadScript;
useWebGL = false;
uploadScript,
useWebGL = false,
supportImageOrientation;
if (ArrayBuffer && !ArrayBuffer.prototype.slice) {
ArrayBuffer.prototype.slice = function (start, end) {
@ -434,12 +435,7 @@ function startUpload(list) {
function fileFilterError(file) {
alert("선택하신 '" + file + "' 파일은 전송할 수 없습니다.\n" +
"gif, png, jpg, webp 사진 파일만 전송할 수 있습니다.");
}
function explorerFileFilterError(file) {
alert("선택하신 '" + file + "' 파일은 전송할 수 없습니다.\n" +
"익스플로러 환경에서는 gif, png, jpg 사진 파일만 \n전송할 수 있습니다.");
"gif, png, jpg 사진 파일만 전송할 수 있습니다.");
}
function imgComplete(img, imgSize, boxId) {
@ -967,16 +963,10 @@ DoUpload.prototype = {
file = files[i];
if (!file.type.match(fileTypeRe)) {
// 엣지를 제외한 ie브라우저인지 체크
var agent = navigator.userAgent.toLowerCase();
if (agent.indexOf('trident') != -1 || agent.indexOf("msie") != -1) {
explorerFileFilterError(file.name);
} else {
FileFilterError(file.name);
}
fileFilterError(file.name);
continue;
}
this.list.push(file);
this.list.push(file);
}
if (this.list.length < 1) {
@ -1089,50 +1079,46 @@ DoUpload.prototype = {
return blob;
},
imageResize : function (image, filetype, resizeWidth, orientation, addWaterMark) {
var canvas, source_w = image.width, source_h = image.height,
resize_h, resize_w, ratio_w, ratio_h, ratio_w_half, ratio_h_half,
imageResize : function (image, filetype, resize_w, orientation, addWaterMark) {
var canvas = document.createElement("canvas"),
ctx = canvas.getContext("2d"),
source_w = image.width,
source_h = image.height,
resize_h, ratio_w, ratio_h, ratio_w_half, ratio_h_half,
source_img, resize_img, source_data, resize_data, j, i,
x2, weight, weights, weights_alpha, gx_a, gx_b, gx_g, gx_r, center_x, center_y, x_start, x_stop,
y_start, y_stop, y, dy, part_w, x, dx, w, pos_x,
ctx, gl, imageData = null;
x2, weight, weights, weights_alpha, gx_a, gx_b, gx_g, gx_r,
center_x, center_y, x_start, x_stop,
y_start, y_stop, y, dy, part_w, x, dx, w, pos_x, gl, imageData = null;
// 카메라 로테이션 보정
if (orientation > 0) {
canvas = document.createElement("canvas");
canvas.width = source_w;
canvas.height = source_h;
ctx = canvas.getContext("2d");
ctx.clearRect(0, 0, canvas.width, canvas.height);
ctx.save();
if (orientation > 0 && !supportImageOrientation) {
if ([5,6,7,8].indexOf(orientation) > -1) {
canvas.width = source_h;
canvas.height = source_w;
} else {
canvas.width = source_w;
canvas.height = source_h;
}
switch (orientation) {
case 2 :
ctx.translate(-1, 0, 0, 1, canvas.width, 0); break;
case 3 :
ctx.translate(-1, 0, 0, -1, canvas.width, canvas.height); break;
case 4 :
ctx.translate(1, 0, 0, -1, 0, canvas.height); break;
case 5 :
ctx.translate(0, 1, 1, 0, 0, 0); break;
case 6 :
ctx.translate(0, 1, -1, 0, canvas.height, 0); break;
case 7 :
ctx.translate(0, -1, -1, 0, canvas.height, canvas.width); break;
case 8 :
ctx.translate(0, -1, 1, 0, 0, canvas.width); break;
case 2 : ctx.transform(-1, 0, 0, 1, source_w, 0); break;
case 3 : ctx.transform(-1, 0, 0, -1, source_w, source_h); break;
case 4 : ctx.transform(1, 0, 0, -1, 0, source_h); break;
case 5 : ctx.transform(0, 1, 1, 0, 0, 0); break;
case 6 : ctx.transform(0, 1, -1, 0, source_h, 0); break;
case 7 : ctx.transform(0, -1, -1, 0, source_h, source_w); break;
case 8 : ctx.transform(0, -1, 1, 0, 0, source_w); break;
default: break;
}
ctx.drawImage(image, 0, 0);
ctx.drawImage(image, 0, 0, source_w, source_h);
imageData = ctx.getImageData(0, 0, canvas.width, canvas.height);
ctx.restore();
source_w = canvas.width;
source_h = canvas.height;
}
if (source_w > resizeWidth) {
resize_w = resizeWidth;
if (source_w > resize_w) {
resize_h = Math.ceil(resize_w / source_w * source_h);
try {
@ -1143,8 +1129,6 @@ DoUpload.prototype = {
canvas = gl_canvas;
});
} catch (ignore) {
canvas = document.createElement("canvas");
ctx = canvas.getContext("2d");
canvas.width = source_w;
canvas.height = source_h;
@ -1216,14 +1200,10 @@ DoUpload.prototype = {
canvas.height = resize_h;
ctx.putImageData(resize_img, 0, 0);
}
} else {
canvas = document.createElement("canvas"),
canvas.width = source_w; canvas.height = source_h;
ctx = canvas.getContext("2d");
canvas.width = source_w;
canvas.height = source_h;
ctx.drawImage(image, 0, 0);
resize_h = source_h;
resize_w = source_w;
}
if (this.reader.watermark && addWaterMark) {
@ -1484,7 +1464,7 @@ function setResizeWidth() {
}
function init(dialog) {
var dlg, i, elem, input, select, value, name, xhr_f, xhr_v, tmpcanvas, glicon;
var dlg, i, elem, input, select, value, name, xhr_f, xhr_v, tmpcanvas, glicon, testImg;
oEditor = this;
oEditor.dialog = dialog;
@ -1556,11 +1536,6 @@ function init(dialog) {
}
}
if (browser.mobile) {
input = document.getElementById('inputImageUpload');
input.setAttribute('capture', 'filesystem');
}
tmpcanvas = document.createElement('canvas');
if (tmpcanvas.getContext('webgl', {preserveDrawingBuffer: true}) ||
tmpcanvas.getContext('experimental-webgl', {preserveDrawingBuffer: true}))
@ -1588,8 +1563,24 @@ function init(dialog) {
xhr_f.send();
xhr_v.send();
}
glicon = new Image();
glicon.className = 'webgl_logo';
glicon.src = uploadImagePath + (useWebGL ? "/webgl.png" : "/webgl-off.png");
document.getElementById('webgl_logo_wrapper').appendChild(glicon);
// 브라우저가 사진 Orientation 보정을 자동으로 지원하지는지 확인
testImg = new Image();
testImg.onload = function () {
supportImageOrientation = testImg.width === 2 && testImg.height === 3;
};
testImg.src =
'data:image/jpeg;base64,/9j/4QAiRXhpZgAATU0AKgAAAAgAAQESAAMAAAABAAYAAAA' +
'AAAD/2wCEAAEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBA' +
'QEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQE' +
'BAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAf/AABEIAAIAAwMBEQACEQEDEQH/x' +
'ABRAAEAAAAAAAAAAAAAAAAAAAAKEAEBAQADAQEAAAAAAAAAAAAGBQQDCAkCBwEBAAAAAAA' +
'AAAAAAAAAAAAAABEBAAAAAAAAAAAAAAAAAAAAAP/aAAwDAQACEQMRAD8AG8T9NfSMEVMhQ' +
'voP3fFiRZ+MTHDifa/95OFSZU5OzRzxkyejv8ciEfhSceSXGjS8eSdLnZc2HDm4M3BxcXw' +
'H/9k=';
}

View File

@ -0,0 +1,43 @@
<?xml version='1.0' encoding='UTF-8'?>
<!ELEMENT Template (Container|PopupWindow|Toolbar)*>
<!ELEMENT Container (Html)*>
<!ELEMENT Html (#PCDATA)>
<!ELEMENT PopupWindow (Html)*>
<!ELEMENT Toolbar (Image|Group)*>
<!ELEMENT Image EMPTY>
<!ATTLIST Image
file CDATA #IMPLIED
>
<!ELEMENT Group (Button)*>
<!ATTLIST Group
name CDATA #IMPLIED
>
<!ELEMENT Button (Attribute)*>
<!ATTLIST Button
name CDATA #IMPLIED
tooltip CDATA #IMPLIED
>
<!ELEMENT Attribute (Icon|Execution)*>
<!ATTLIST Attribute
class CDATA #IMPLIED
width CDATA #IMPLIED
height CDATA #IMPLIED
check CDATA #IMPLIED
default CDATA #IMPLIED
use CDATA #IMPLIED
type CDATA #IMPLIED
node CDATA #IMPLIED
>
<!ELEMENT Icon EMPTY>
<!ATTLIST Icon
position CDATA #IMPLIED
width CDATA #IMPLIED
class CDATA #IMPLIED
margin CDATA #IMPLIED
alt CDATA #IMPLIED
>
<!ELEMENT Execution EMPTY>
<!ATTLIST Execution
method CDATA #IMPLIED
value CDATA #IMPLIED
>