Changeset 3370
- Timestamp:
- 05/27/07 06:41:11 (3 years ago)
- Location:
- sandbox
- Files:
-
- 7 modified
-
blog/owner/setting/entry/index.php (modified) (2 diffs)
-
blog/owner/setting/entry/resample/index.php (modified) (2 diffs)
-
components/Textcube.Function.Image.php (modified) (4 diffs)
-
lib/function/image.php (modified) (1 diff)
-
lib/suri.php (modified) (2 diffs)
-
lib/view/view.php (modified) (2 diffs)
-
plugins/FM_Modern/editor.js (modified) (10 diffs)
Legend:
- Unmodified
- Added
- Removed
-
sandbox/blog/owner/setting/entry/index.php
r3138 r3370 62 62 break; 63 63 } 64 }65 }66 67 window.addEventListener("load", execLoadFunction, false);68 function execLoadFunction() {69 if (document.getElementById('topPadding').value != "direct") {70 document.getElementById('topPadding').removeAttribute('disabled');71 document.getElementById('topPaddingManual').setAttribute('disabled', 'disabled');72 } else {73 document.getElementById('topPadding').removeAttribute('disabled');74 }75 if (document.getElementById('rightPadding').value != "direct") {76 document.getElementById('rightPadding').removeAttribute('disabled');77 document.getElementById('rightPaddingManual').setAttribute('disabled', 'disabled');78 } else {79 document.getElementById('rightPadding').removeAttribute('disabled');80 }81 if (document.getElementById('bottomPadding').value != "direct") {82 document.getElementById('bottomPadding').removeAttribute('disabled');83 document.getElementById('bottomPaddingManual').setAttribute('disabled', 'disabled');84 } else {85 document.getElementById('bottomPadding').removeAttribute('disabled');86 }87 if (document.getElementById('leftPadding').value != "direct") {88 document.getElementById('leftPadding').removeAttribute('disabled');89 document.getElementById('leftPaddingManual').setAttribute('disabled', 'disabled');90 } else {91 document.getElementById('leftPadding').removeAttribute('disabled');92 64 } 93 65 } … … 169 141 <dt><span class="label"><?php echo _t('기본 설정');?></span></dt> 170 142 <dd> 171 <input type="checkbox" class="checkbox" id="useResamplingAsDefault" name="useResamplingAsDefault" value="yes" onclick="if (this.checked == false && document.getElementById('useWatermarkAsDefault').checked == true) document.getElementById('useWatermarkAsDefault').checked = false;"<?php echo (getUserSetting("resamplingDefault") == "yes") ? ' checked="checked"' : NULL;?> /><label for="useResamplingAsDefault"><?php echo _t('이미지 리샘플링 기능을 기본으로 사용합니다. <em>이 기능 사용시 서버에 많은 부하가 걸릴 수 있으니 주의하시기 바랍니다.</em>');?></label><br /> 172 <?php 173 if (file_exists(ROOT."/attach/$owner/watermark.gif")) { 174 ?> 175 <input type="checkbox" class="checkbox" id="useWatermarkAsDefault" name="useWatermarkAsDefault" value="yes" onclick="if (this.checked == true && document.getElementById('useResamplingAsDefault').checked == false) document.getElementById('useResamplingAsDefault').checked = true;"<?php echo (getUserSetting("waterMarkDefault") == "yes") ? ' checked="checked"' : NULL;?> /><label for="useWatermarkAsDefault"><?php echo _t('워터마크 기능을 기본으로 사용합니다.');?></label> 176 <?php 177 } 178 ?> 179 </dd> 180 </dl> 181 <dl id="watermark-line" class="line"> 182 <dt><span class="label"><?php echo _t('워터 마크');?></span></dt> 183 <dd> 184 <p><?php echo _t('워터 마크는 그림이나 사진의 소유권을 표시하거나 위조를 방지하기 위하여 넣는 무늬입니다.');?></p> 185 <?php 186 if (file_exists(ROOT."/attach/$owner/watermark.gif")) { 187 $waterMarkInfo = getimagesize(ROOT."/attach/$owner/watermark.gif"); 188 if ($waterMarkInfo[0] > 150) { 189 ?> 190 <a href="<?php echo $service['path'];?>/attach/<?php echo $owner;?>/watermark.gif?randomseed=<?php echo rand();?>" onclick="window.open(this.href); return false;"><img src="<?php echo $service['path'];?>/attach/<?php echo $owner;?>/watermark.gif?randomseed=<?php echo rand();?>" width="150" border="1" alt="<?php echo _t('워터마크 이미지');?>" /></a> 191 <?php 192 } else { 193 ?> 194 <img src="<?php echo $service['path'];?>/attach/<?php echo $owner;?>/watermark.gif?randomseed=<?php echo rand();?>" border="1" alt="<?php echo _t('워터마크 이미지');?>" /> 195 <?php 196 } 197 } 198 ?> 199 <br /><input type="file" class="input-file" name="waterMark" /><br /> 200 <input type="checkbox" class="checkbox" id="deleteWaterMark" name="deleteWaterMark" value="yes"<?php echo file_exists(ROOT."/attach/$owner/watermark.gif") ? '' : ' disabled="disabled"';?> /><label for="deleteWaterMark"><?php echo _t('워터 마크를 초기화합니다.');?></label> 201 </dd> 202 </dl> 203 <?php 204 $waterMarkPosition = getUserSetting("waterMarkPosition", "left=10|bottom=10"); 205 $waterMarkPosition = explode("|", $waterMarkPosition); 206 parse_str($waterMarkPosition[0]); 207 parse_str($waterMarkPosition[1]); 208 209 if (isset($left)) 210 $horizontalValue = $left; 211 if (isset($right)) 212 $horizontalValue = $right; 213 if (isset($center)) 214 $horizontalValue = 0; 215 if (isset($top)) 216 $verticalValue = $top; 217 if (isset($bottom)) 218 $verticalValue = $bottom; 219 if (isset($middle)) 220 $verticalValue = 0; 221 ?> 222 <dl id="watermark-position-line" class="line"> 223 <dt><span class="label"><?php echo _t('워터마크 위치');?></span></dt> 224 <dd> 225 <div id="vertical-position"> 226 <select name="verticalType"<?php echo file_exists(ROOT."/attach/$owner/watermark.gif") ? '' : ' disabled="disabled"';?>> 227 <option value="top"<?php echo isset($top) ? ' selected="selected"' : '';?>><?php echo _t('상단');?></option> 228 <option value="middle"<?php echo isset($middle) ? ' selected="selected"' : '';?>><?php echo _t('중앙');?></option> 229 <option value="bottom"<?php echo isset($bottom) ? ' selected="selected"' : '';?>><?php echo _t('하단');?></option> 230 </select> 231 <input type="text" class="input-text" name="verticalPosition" value="<?php echo $verticalValue;?>"<?php echo file_exists(ROOT."/attach/$owner/watermark.gif") ? '' : ' disabled="disabled"';?> />px 232 </div> 233 <div id="horizontal-position"> 234 <select name="horizontalType"<?php echo file_exists(ROOT."/attach/$owner/watermark.gif") ? '' : ' disabled="disabled"';?>> 235 <option value="left"<?php echo isset($left) ? ' selected="selected"' : '';?>><?php echo _t('좌측');?></option> 236 <option value="center"<?php echo isset($center) ? ' selected="selected"' : '';?>><?php echo _t('중앙');?></option> 237 <option value="right"<?php echo isset($right) ? ' selected="selected"' : '';?>><?php echo _t('우측');?></option> 238 </select> 239 <input type="text" class="input-text" name="horizontalPosition" value="<?php echo $horizontalValue;?>" <?php echo file_exists(ROOT."/attach/$owner/watermark.gif") ? '' : ' disabled="disabled"';?> />px 240 </div> 241 </dd> 242 </dl> 243 244 <?php 245 $thumbnailPadding = getThumbnailPadding(); 246 $colorOfPadding = getThumbnailPaddingColor(); 247 ?> 248 <dl id="padding-line" class="line"> 249 <dt><span class="label"><?php echo _t('이미지 여백');?></span></dt> 250 <dd> 251 <?php 252 $paddingOrder = array("top", "bottom", "left", "right"); 253 $paddingText = array(_t('상단 여백'), _t('하단 여백'), _t('좌측 여백'), _t('우측 여백')); 254 255 for ($i=0; $i<count($paddingOrder); $i++) { 256 $tempIndex = $paddingOrder[$i]; 257 ?> 258 <div id="<?php echo $paddingOrder[$i];?>-padding"> 259 <span class="label"><?php echo $paddingText[$i];?></span> 260 <select id="<?php echo $paddingOrder[$i];?>Padding" name="<?php echo $paddingOrder[$i];?>Padding" onchange="checkManualInput(this)" disabled="disabled"> 261 <option value="0"<?php echo $thumbnailPadding[$tempIndex] == 0 ? ' selected="selected"' : '';?>>0px</option> 262 <option value="5"<?php echo $thumbnailPadding[$tempIndex] == 5 ? ' selected="selected"' : '';?>>5px</option> 263 <option value="10"<?php echo $thumbnailPadding[$tempIndex] == 10 ? ' selected="selected"' : '';?>>10px</option> 264 <option value="15"<?php echo $thumbnailPadding[$tempIndex] == 15 ? ' selected="selected"' : '';?>>15px</option> 265 <option value="20"<?php echo $thumbnailPadding[$tempIndex] == 20 ? ' selected="selected"' : '';?>>20px</option> 266 <option value="25"<?php echo $thumbnailPadding[$tempIndex] == 25 ? ' selected="selected"' : '';?>>25px</option> 267 <option value="direct"<?php echo !in_array($thumbnailPadding[$tempIndex], array(0, 5, 10, 15, 20, 25)) ? ' selected="selected"' : '';?>><?php echo _t('직접입력');?></option> 268 </select> 269 <?php 270 $temp = $thumbnailPadding[$paddingOrder[$i]]; 271 ?> 272 <input type="text" class="input-text" id="<?php echo $paddingOrder[$i];?>PaddingManual" name="<?php echo $paddingOrder[$i];?>PaddingManual" value="<?php echo $temp;?>" />px 273 </div> 274 <?php 275 } 276 ?> 277 <div id="padding-color"> 278 <span class="label"><?php echo _t('여백 색상');?></span> 279 <input type="text" class="input-text" name="paddingColor" value="<?php echo $colorOfPadding;?>" /> 280 </div> 143 <input type="checkbox" class="checkbox" id="useResamplingAsDefault" name="useResamplingAsDefault" value="yes"<?php echo (getUserSetting("resamplingDefault") == "yes") ? ' checked="checked"' : NULL;?> /><label for="useResamplingAsDefault"><?php echo _t('이미지 리샘플링 기능을 기본으로 사용합니다.');?> <em><?php echo _t('이 기능 사용시 서버에 많은 부하가 걸릴 수 있으니 주의하시기 바랍니다.');?></em></label> 281 144 </dd> 282 145 </dl> -
sandbox/blog/owner/setting/entry/resample/index.php
r3108 r3370 7 7 $IV = array( 8 8 'POST' => array( 9 'deleteWaterMark' => array('string', 'default' => "no"), 10 'horizontalType' => array('string', 'default' => "left"), 11 'verticalType' => array('string', 'default' => "top"), 12 'horizontalPosition' => array('int', 'default' => 0), 13 'verticalPosition' => array('int', 'default' => 0), 14 'topPadding' => array('any', 'mandatory' => false), 15 'rightPadding' => array('any', 'mandatory' => false), 16 'bottomPadding' => array('any', 'mandatory' => false), 17 'leftPadding' => array('any', 'mandatory' => false), 18 'topPaddingManual' => array('int', 'mandatory' => false), 19 'rightPaddingManual' => array('int', 'mandatory' => false), 20 'bottomPaddingManual' => array('int', 'mandatory' => false), 21 'leftPaddingManual' => array('int', 'mandatory' => false), 22 'paddingColor' => array('string', 'default' => "FFFFFF"), 23 'useResamplingAsDefault' => array('string', 'mandatory' => false), 24 'useWatermarkAsDefault' => array('string', 'mandatory' => false) 25 ), 26 'FILES' => array( 27 'waterMark' => array('file', 'mandatory' => false) 9 'useResamplingAsDefault' => array('string', 'mandatory' => false) 28 10 ) 29 11 ); … … 32 14 33 15 $isAjaxRequest = false; // checkAjaxRequest(); 34 $errorArray = array();35 16 36 17 // 기본 설정 37 18 if (isset($_POST['useResamplingAsDefault']) && ($_POST['useResamplingAsDefault'] == "yes")) { 38 19 setUserSetting("resamplingDefault", "yes"); 39 } else if (getUserSetting("resamplingDefault") == "yes"){20 } else { 40 21 removeUserSetting("resamplingDefault"); 41 removeUserSetting("waterMarkDefault");42 deleteFilesByRegExp(ROOT."/cache/thumbnail/$owner/", '');43 22 } 44 45 if (isset($_POST['useWatermarkAsDefault']) && ($_POST['useWatermarkAsDefault'] == "yes")) {46 setUserSetting("waterMarkDefault", "yes");47 } else if (getUserSetting("waterMarkDefault") == "yes") {48 removeUserSetting("waterMarkDefault");49 deleteFilesByRegExp(ROOT."/cache/thumbnail/$owner/", '');50 }51 52 // 워터마크 처리.53 if (isset($_POST['deleteWaterMark']) && ($_POST['deleteWaterMark'] == "yes")) {54 unlink(ROOT."/attach/$owner/watermark.gif");55 }56 57 // 업로드된 새 워터마크가 있는 경우.58 if (!empty($_FILES['waterMark']['tmp_name'])) {59 $fileExt = Path::getExtension($_FILES['waterMark']['name']);60 61 if (!in_array($fileExt, array('.gif', '.jpg', '.png'))) {62 if ($isAjaxRequest) {63 printRespond(array('error' => 1, 'msg' => _t('변경하지 못했습니다.')));64 }65 // TODO : --???? error handling needed66 header("Location: ".$_SERVER['HTTP_REFERER']);67 exit;68 } else {69 requireComponent('Textcube.Data.Attachment');70 Attachment::confirmFolder();71 72 if (move_uploaded_file($_FILES['waterMark']['tmp_name'], ROOT."/attach/$owner/watermark.gif")) {73 @chmod(ROOT . "/attach/$owner/watermark.gif", 0666);74 deleteAllThumbnails(ROOT."/cache/thumbnail/$owner");75 }76 }77 } else if (!file_exists(ROOT."/attach/$owner/watermark.gif")) {78 $_POST['horizontalType'] = "left";79 $_POST['verticalType'] = "top";80 $_POST['horizontalPosition'] = "0";81 $_POST['verticalPosition'] = "0";82 }83 84 $bErrorFlag = false;85 if (!in_array(strtolower($_POST['verticalType']), array("top", "middle", "bottom")))86 $bErrorFlag = true;87 if (!in_array(strtolower($_POST['horizontalType']), array("left", "center", "right")))88 $bErrorFlag = true;89 if (!preg_match("/^[0-9]+$/", $_POST['verticalPosition']))90 $bErrorFlag = true;91 if (!preg_match("/^[0-9]+$/", $_POST['horizontalPosition']))92 $bErrorFlag = true;93 94 // 워터마크 포지션 값에 오류가 있으면 이전 값으로 되돌림.95 if ($bErrorFlag == true) {96 $errorArray['position'] = true;97 } else {98 $_POST['verticalPosition'] = preg_replace("/^0*/", '', $_POST['verticalPosition']);99 $_POST['verticalPosition'] = empty($_POST['verticalPosition']) ? 0 : $_POST['verticalPosition'];100 $_POST['horizontalPosition'] = preg_replace("/^0*/", '', $_POST['horizontalPosition']);101 $_POST['horizontalPosition'] = empty($_POST['horizontalPosition']) ? 0 : $_POST['horizontalPosition'];102 103 $strNewPosition = "{$_POST['horizontalType']}={$_POST['horizontalPosition']}|{$_POST['verticalType']}={$_POST['verticalPosition']}";104 $strOldPosition = getUserSetting("waterMarkPosition");105 106 if (is_null($strOldPosition) || $strNewPosition != $strOldPosition) {107 setUserSetting('waterMarkPosition', $strNewPosition);108 deleteAllThumbnails(ROOT."/cache/thumbnail/$owner");109 }110 }111 112 // 썸네일 여백.113 if ($_POST['topPadding'] == "direct")114 $_POST['topPadding'] = $_POST['topPaddingManual'];115 if ($_POST['bottomPadding'] == "direct")116 $_POST['bottomPadding'] = $_POST['bottomPaddingManual'];117 if ($_POST['rightPadding'] == "direct")118 $_POST['rightPadding'] = $_POST['rightPaddingManual'];119 if ($_POST['leftPadding'] == "direct")120 $_POST['leftPadding'] = $_POST['leftPaddingManual'];121 122 $bErrorFlag = false;123 if (!preg_match("/^[0-9]+$/", $_POST['topPadding']))124 $bErrorFlag = true;125 if (!preg_match("/^[0-9]+$/", $_POST['bottomPadding']))126 $bErrorFlag = true;127 if (!preg_match("/^[0-9]+$/", $_POST['rightPadding']))128 $bErrorFlag = true;129 if (!preg_match("/^[0-9]+$/", $_POST['leftPadding']))130 $bErrorFlag = true;131 132 // 썸네일 여백 값에 오류가 있으면 이전 값으로 되돌림.133 if ($bErrorFlag == true)134 $errorArray['padding'] = true;135 136 if ($bErrorFlag == false) {137 $_POST['topPadding'] = preg_replace("/^0*/", '', $_POST['topPadding']);138 $_POST['bottomPadding'] = preg_replace("/^0*/", '', $_POST['bottomPadding']);139 $_POST['rightPadding'] = preg_replace("/^0*/", '', $_POST['rightPadding']);140 $_POST['leftPadding'] = preg_replace("/^0*/", '', $_POST['leftPadding']);141 142 if (empty($_POST['topPadding']))143 $_POST['topPadding'] = 0;144 if (empty($_POST['bottomPadding']))145 $_POST['bottomPadding'] = 0;146 if (empty($_POST['rightPadding']))147 $_POST['rightPadding'] = 0;148 if (empty($_POST['leftPadding']))149 $_POST['leftPadding'] = 0;150 151 $strNewPadding = "{$_POST['topPadding']}|{$_POST['rightPadding']}|{$_POST['bottomPadding']}|{$_POST['leftPadding']}";152 $strOldPadding = DBQuery::queryCell("SELECT `value` FROM `{$database['prefix']}UserSettings` WHERE `user` = $owner AND `name` = ");153 154 if ($strOldPadding == false || $strNewPadding != $strOldPadding) {155 setUserSetting('thumbnailPadding', $strNewPadding);156 deleteAllThumbnails(ROOT."/cache/thumbnail/$owner");157 }158 }159 160 // 썸네일 여백 색상.161 if (preg_match("/^#?([A-F0-9]{3,6})$/i", $_POST['paddingColor'], $temp)) {162 $strNewColor = $temp[1];163 $strOldColor = getUserSetting("thumbnailPaddingColor");164 165 if (is_null($strOldColor) || $strNewColor != $strOldColor) {166 setUserSetting('thumbnailPaddingColor', $strNewColor);167 deleteAllThumbnails(ROOT."/cache/thumbnail/$owner");168 }169 } else {170 $errorArray['paddingColor'] = true;171 }172 173 if (count($errorArray) > 0)174 $errorResult['error'] = 1;175 else176 $errorResult['error'] = 0;177 23 178 24 $isAjaxRequest ? printRespond($errorResult) : header("Location: ".$_SERVER['HTTP_REFERER']); -
sandbox/components/Textcube.Function.Image.php
r3109 r3370 11 11 } 12 12 13 function resample($width, $height , $padding=NULL) {13 function resample($width, $height) { 14 14 if (empty($width) && empty($height)) 15 15 return false; 16 16 if (empty($this->imageFile) || !file_exists($this->imageFile)) 17 17 return false; 18 19 // validate padding values.20 if (!is_null($padding)) {21 if (!isset($padding['top']) || !is_int($padding['top'])) {22 $padding['top'] = 0;23 }24 if (!isset($padding['right']) || !is_int($padding['right'])) {25 $padding['right'] = 0;26 }27 if (!isset($padding['bottom']) || !is_int($padding['bottom'])) {28 $padding['bottom'] = 0;29 }30 if (!isset($padding['left']) || !is_int($padding['left'])) {31 $padding['left'] = 0;32 }33 } else {34 $padding['top'] = 0;35 $padding['right'] = 0;36 $padding['bottom'] = 0;37 $padding['left'] = 0;38 }39 40 // validate background color.41 if (isset($padding['bgColor'])) {42 if (!eregi("^[0-9A-F]{3,6}$", $padding['bgColor']))43 $padding['bgColor'] = "FFFFFF";44 } else {45 $padding['bgColor'] = "FFFFFF";46 }47 48 // |---------------------------- $width ---------------------------|49 // |-- $padding['left'] --|-- $coreWidth --|-- $padding['right'] --|50 $coreWidth = $width - $padding['left'] - $padding['right'];51 $coreHeight = $height - $padding['top'] - $padding['bottom'];52 if ($coreWidth < 0)53 $coreWidth = 0;54 if ($coreHeight < 0)55 $coreHeight = 0;56 18 57 19 // create an image device as image format. … … 96 58 break; 97 59 } 98 $originImageDevice = fireEvent('BeforeResizeImage', $originImageDevice, $this); 60 // 리샘플링은 최종단계에서 리샘플링만을 하는 기능임. 시스템을 예로 들면 OS의 기능에 해당함. 61 // 이미지 프로세스는 어플리케이션의 기능으로 볼 수 있고, 따라서 이미지 리샘플링 중에는 이벤트가 끼어들면 안 됨. 62 //$originImageDevice = fireEvent('BeforeResizeImage', $originImageDevice, $this); 99 63 100 64 if (Path::getExtension($this->imageFile) == ".gif") { … … 104 68 } 105 69 106 $bgColorBy16 = $this->hexRGB( $padding['bgColor']);70 $bgColorBy16 = $this->hexRGB("FFFFFF"); 107 71 $temp = imagecolorallocate($this->resultImageDevice, $bgColorBy16['R'], $bgColorBy16['G'], $bgColorBy16['B']); 108 72 imagefilledrectangle($this->resultImageDevice, 0, 0, $width, $height, $temp); 109 imagecopyresampled($this->resultImageDevice, $originImageDevice, $padding['left'], $padding['top'], 0, 0, $coreWidth, $coreHeight, imagesx($originImageDevice), imagesy($originImageDevice));73 imagecopyresampled($this->resultImageDevice, $originImageDevice, 0, 0, 0, 0, $width, $height, imagesx($originImageDevice), imagesy($originImageDevice)); 110 74 imagedestroy($originImageDevice); 111 $this->resultImageDevice = fireEvent('AfterResizeImage', $this->resultImageDevice, $this);75 //$this->resultImageDevice = fireEvent('AfterResizeImage', $this->resultImageDevice, $this); 112 76 113 77 return true; … … 351 315 } 352 316 353 function checkExistingThumbnail($originSrc, $thumbnailSrc, $argWidth, $argHeight, $paddingArray=NULL, $waterMarkArray=NULL) {354 if (!file_exists($originSrc)) {355 return 0;356 }357 $originImageInfo = getimagesize($originSrc);358 list($tempWidth, $tempHeight) = Image::calcOptimizedImageSize($originImageInfo[0], $originImageInfo[1], $argWidth, $argHeight);359 360 if (!file_exists($thumbnailSrc)) {361 // in the case of a reduced image.362 if ($originImageInfo[0] > $tempWidth || $originImageInfo[1] > $tempHeight) {363 return 2;364 // even if a original size image or a magnified image, create a thumbnail in the case of existing a watermark file or padding value.365 } else if (($originImageInfo[0] <= $tempWidth || $originImageInfo[1] <= $tempHeight) && (file_exists($waterMarkArray['path']) || !empty($paddingArray))) {366 return 2;367 }368 } else {369 $thumbnailImageInfo = getimagesize($thumbnailSrc);370 $resizedWidth = $tempWidth;371 $resizedHeight = $tempHeight;372 373 // in the case of a reduced image.374 if ($thumbnailImageInfo[0] > $resizedWidth || $thumbnailImageInfo[1] > $resizedHeight) {375 return 1;376 // no process.377 } else {378 return 0;379 }380 }381 }382 383 317 function getImageType($filename) { 384 318 if (file_exists($filename)) { -
sandbox/lib/function/image.php
r3226 r3370 119 119 120 120 // img의 width/height에 맞춰 이미지를 리샘플링하는 함수. 썸네일 함수가 아님! 주의. 121 function resampleImage($imgString, $originSrc, $useAbsolutePath) { 122 global $database, $owner, $serviceURL, $pathURL; 123 124 if (!extension_loaded('gd')) { 125 return $imgString; 126 } 127 128 requireComponent('Textcube.Function.Image'); 129 if (!is_dir(ROOT."/cache/thumbnail")) { 130 @mkdir(ROOT."/cache/thumbnail"); 131 @chmod(ROOT."/cache/thumbnail", 0777); 132 } 133 134 if (!is_dir(ROOT."/cache/thumbnail/$owner")) { 135 @mkdir(ROOT."/cache/thumbnail/$owner"); 136 @chmod(ROOT."/cache/thumbnail/$owner", 0777); 137 } 138 139 $originFileName = basename($originSrc); 140 141 // 여기로 넘어오는 값은 이미 getAttachmentBinder() 함수에서 고정값으로 변환된 값이므로 % 값은 고려할 필요 없음. 142 if (preg_match('/width="([1-9][0-9]*)"/i', $imgString, $temp)) { 143 $tempWidth = $temp[1]; 144 } 145 146 if (preg_match('/height="([1-9][0-9]*)"/i', $imgString, $temp)) { 147 $tempHeight = $temp[1]; 148 } 149 150 $newTempFileName = preg_replace("/\.([[:alnum:]]+)$/i", ".w{$tempWidth}-h{$tempHeight}.\\1", $originFileName); 151 $tempSrc = ROOT."/cache/thumbnail/$owner/".$newTempFileName; 152 153 $tempURL = $pathURL."/thumbnail/$owner/".$newTempFileName; 154 if ($useAbsolutePath == true) { 155 $tempURL = "$serviceURL/thumbnail/$owner/$newTempFileName"; 156 } 157 158 if (file_exists($tempSrc)) { 159 $imgString = preg_replace('/src="([^"]+)"/i', 'src="'.$tempURL.'"', $imgString); 160 $imgString = preg_replace('/width="([^"]+)"/i', 'width="'.$tempWidth.'"', $imgString); 161 $imgString = preg_replace('/height="([^"]+)"/i', 'height="'.$tempHeight.'"', $imgString); 162 $imgString = preg_replace('/onclick="open_img\(\'([^\']+)\'\)"/', "onclick=\"open_img('$serviceURL/attach/$owner/$originFileName')\"", $imgString); 163 } else { 164 $AttachedImage = new Image(); 165 $AttachedImage->imageFile = $originSrc; 166 167 // 리샘플링 시작. 168 if ($AttachedImage->resample($tempWidth, $tempHeight)) { 169 // 리샘플링된 파일 저장. 170 $AttachedImage->createThumbnailIntoFile($tempSrc); 171 $imgString = preg_replace('/src="([^"]+)"/i', 'src="'.$tempURL.'"', $imgString); 172 $imgString = preg_replace('/width="([^"]+)"/i', 'width="'.$tempWidth.'"', $imgString); 173 $imgString = preg_replace('/height="([^"]+)"/i', 'height="'.$tempHeight.'"', $imgString); 174 $imgString = preg_replace('/onclick="open_img\(\'([^\']+)\'\)"/', "onclick=\"open_img('$serviceURL/attach/$owner/$originFileName')\"", $imgString); 175 } 176 177 unset($AttachedImage); 178 } 179 180 return $imgString; 181 } 182 121 183 function makeThumbnail($imgString, $originSrc, $paddingArray, $waterMarkArray, $useAbsolutePath) { 122 184 global $database, $owner, $blogURL, $serviceURL, $pathURL; -
sandbox/lib/suri.php
r3294 r3370 125 125 $adminSkinSetting['skin'] = "/style/admin/".getUserSetting("adminSkin", "default"); 126 126 127 // 리샘플링 설정값. 128 $useImageResampling = getUserSetting("resamplingDefault"); 129 127 130 // content 본문에 removeAllTags()가 적용되는 것을 방지하기 위한 프로세스를 위한 변수. 128 131 $contentContainer = array(); … … 132 135 else 133 136 $adminSkinSetting['editorTemplate'] = "/style/default-wysiwyg.css"; 134 135 // 워터 마크 파일이 있는 곳.136 if (file_exists(ROOT."/attach/$owner/watermark.gif")) {137 $waterMarkPath = ROOT."/attach/$owner/watermark.gif";138 } else {139 $waterMarkPath = NULL;140 }141 142 $waterMarkArray = array();143 $waterMarkArray['path'] = $waterMarkPath;144 $waterMarkArray['position'] = getWaterMarkPosition();145 $waterMarkArray['gamma'] = getWaterMarkGamma();146 147 $paddingArray = array();148 $padding = getThumbnailPadding();149 $paddingArray['top'] = $padding['top'];150 $paddingArray['right'] = $padding['right'];151 $paddingArray['bottom'] = $padding['bottom'];152 $paddingArray['left'] = $padding['left'];153 $paddingArray['bgColor'] = getThumbnailPaddingColor();154 155 unset($padding);156 unset($waterMarkPath);157 137 158 138 if (!file_exists(ROOT . '/config.php')) { -
sandbox/lib/view/view.php
r3369 r3370 944 944 945 945 function getEntryContentView($owner, $id, $content, $formatter, $keywords = array(), $type = 'Post', $useAbsolutePath = false, $bRssMode = false) { 946 global $hostURL, $service, $owner, $ waterMarkArray, $paddingArray;946 global $hostURL, $service, $owner, $useImageResampling; 947 947 948 948 $content = fireEvent('Format' . $type . 'Content', $content, $id); … … 957 957 958 958 // image resampling 959 if ($useAbsolutePath == true) { 960 preg_match("@<img.+src=['\"]{$hostURL}{$service['path']}/attach/{$owner}/(.+)['\"].+/>@Ui", $view, $images, PREG_SET_ORDER); 961 $view = preg_replace("@<img.+src=['\"]{$hostURL}{$service['path']}/attach/{$owner}/(.+)['\"].+/>@Ui", '[#####_#####_#####_image_#####_#####_#####]', $view); 962 } else { 963 preg_match_all("@<img.+src=['\"]{$service['path']}/attach/{$owner}/(.+)['\"].+/>@Ui", $view, $images, PREG_SET_ORDER); 964 $view = preg_replace("@<img.+src=['\"]{$service['path']}/attach/{$owner}/(.+)['\"].+/>@Ui", '[#####_#####_#####_image_#####_#####_#####]', $view); 965 } 959 if ($useImageResampling == true) { 960 if ($useAbsolutePath == true) { 961 preg_match("@<img.+src=['\"]{$hostURL}{$service['path']}/attach/{$owner}/(.+)['\"].+/>@Ui", $view, $images, PREG_SET_ORDER); 962 $view = preg_replace("@<img.+src=['\"]{$hostURL}{$service['path']}/attach/{$owner}/(.+)['\"].+/>@Ui", '[#####_#####_#####_image_#####_#####_#####]', $view); 963 } else { 964 preg_match_all("@<img.+src=['\"]{$service['path']}/attach/{$owner}/(.+)['\"].+/>@Ui", $view, $images, PREG_SET_ORDER); 965 $view = preg_replace("@<img.+src=['\"]{$service['path']}/attach/{$owner}/(.+)['\"].+/>@Ui", '[#####_#####_#####_image_#####_#####_#####]', $view); 966 } 966 967 967 if (count($images) > 0) { 968 for ($i=0; $i<count($images); $i++) { 969 $view = preg_replace('@\[#####_#####_#####_image_#####_#####_#####\]@', makeThumbnail($images[$i][0], "../attach/{$owner}/{$images[$i][1]}", $paddingArray, $waterMarkArray, $useAbsolutePath), $view, 1); 968 if (count($images) > 0) { 969 for ($i=0; $i<count($images); $i++) { 970 $view = preg_replace('@\[#####_#####_#####_image_#####_#####_#####\]@', resampleImage($images[$i][0], ROOT . "/attach/{$owner}/{$images[$i][1]}", $useAbsolutePath), $view, 1); 971 } 970 972 } 971 973 } 972 974 973 return $view; ;975 return $view; 974 976 } 975 977 -
sandbox/plugins/FM_Modern/editor.js
r3106 r3370 608 608 getObject(propertyWindowId + "_alt1").value = trim(this.unHtmlspecialchars(this.removeQuot(this.parseAttribute(values[2], "alt")))); 609 609 getObject(propertyWindowId + "_caption1").value = trim(this.unHtmlspecialchars(this.removeQuot(values[3]))); 610 if (this.parseAttribute(values[2], "class").match("tt-resampling")) {611 getObject(propertyWindowId + "_resample1").checked = true;612 } else if (this.parseAttribute(values[2], "class").match("tt-watermark")) {613 getObject(propertyWindowId + "_watermark1").checked = true;614 getObject(propertyWindowId + "_resample1").checked = true;615 }616 610 617 611 this.propertyFilename1 = values[1]; … … 655 649 getObject(propertyWindowId + "_alt2").value = trim(this.unHtmlspecialchars(this.removeQuot(this.parseAttribute(values[5], "alt")))); 656 650 getObject(propertyWindowId + "_caption2").value = trim(this.unHtmlspecialchars(this.removeQuot(values[6]))); 657 if (this.parseAttribute(values[5], "class").match("tt-resampling")) {658 getObject(propertyWindowId + "_resample2").checked = true;659 } else if (this.parseAttribute(values[5], "class").match("tt-watermark")) {660 getObject(propertyWindowId + "_watermark2").checked = true;661 getObject(propertyWindowId + "_resample2").checked = true;662 }663 651 } 664 652 … … 670 658 getObject(propertyWindowId + "_alt3").value = trim(this.unHtmlspecialchars(this.removeQuot(this.parseAttribute(values[8], "alt")))); 671 659 getObject(propertyWindowId + "_caption3").value = trim(this.unHtmlspecialchars(this.removeQuot(values[9]))); 672 if (this.parseAttribute(values[8], "class").match("tt-resampling")) {673 getObject(propertyWindowId + "_resample3").checked = true;674 } else if (this.parseAttribute(values[8], "class").match("tt-watermark")) {675 getObject(propertyWindowId + "_watermark3").checked = true;676 getObject(propertyWindowId + "_resample3").checked = true;677 }678 660 } 679 661 … … 2296 2278 var fixPosition = this.fixPosition, hasGD = this.hasGD; 2297 2279 2298 var imagefunc = function (p, q) {2299 if (!hasGD) return '';2300 return '' + ///2301 '<dl class="resample-property-box line">' +2302 '<dd>' +2303 '<input type="checkbox" id="__ID__propertyImage' + p + '_resample' + q + '" onclick="__EDITOR__.checkResampling(\'resample\', ' + p + ', ' + q + '); __EDITOR__.setProperty()" /> <label for="__ID__propertyImage' + p + '_resample' + q + '">' + _t('이미지에 리샘플링을 적용합니다.') + '</label><br />' +2304 '<input type="checkbox" id="__ID__propertyImage' + p + '_watermark' + q + '" onclick="checkResampling(\'watermark\', ' + p + ', ' + q + '); __EDITOR__.setProperty()" /> <label for="__ID__propertyImage' + p + '_watermark' + q + '">' + _t('이미지에 워터마크를 찍습니다.') + '</label>' +2305 '</dd>' +2306 '</dl>';2307 }2308 2309 2280 // hyperlink 2310 2281 var html = //// … … 2395 2366 '<dd><textarea class="input-text" id="__ID__propertyImage1_caption1" onkeyup="__EDITOR__.setProperty()" onkeypress="return preventEnter(event);"></textarea></dd>' + 2396 2367 '</dl>' + 2397 imagefunc(1, 1) +2398 2368 '</div>' + 2399 2369 '</div>'; … … 2421 2391 '<dd><textarea class="input-text" id="__ID__propertyImage2_caption1" onkeyup="__EDITOR__.setProperty()" onkeypress="return preventEnter(event);"></textarea></dd>' + 2422 2392 '</dl>' + 2423 imagefunc(2, 1) +2424 2393 '</div>' + 2425 2394 '<div class="group">' + … … 2437 2406 '<dd><textarea class="input-text" id="__ID__propertyImage2_caption2" onkeyup="__EDITOR__.setProperty()" onkeypress="return preventEnter(event);"></textarea></dd>' + 2438 2407 '</dl>' + 2439 imagefunc(2, 2) +2440 2408 '</div>' + 2441 2409 '</div>'; … … 2463 2431 '<dd><textarea class="input-text" id="__ID__propertyImage3_caption1" onkeyup="__EDITOR__.setProperty()" onkeypress="return preventEnter(event);"></textarea></dd>' + 2464 2432 '</dl>' + 2465 imagefunc(3, 1) +2466 2433 '</div>' + 2467 2434 '<div class="group">' + … … 2479 2446 '<dd><textarea class="input-text" id="__ID__propertyImage3_caption2" onkeyup="__EDITOR__.setProperty()" onkeypress="return preventEnter(event);"></textarea></dd>' + 2480 2447 '</dl>' + 2481 imagefunc(3, 2) +2482 2448 '</div>' + 2483 2449 '<div class="group">' + … … 2495 2461 '<dd><textarea class="input-text" id="__ID__propertyImage3_caption3" onkeyup="__EDITOR__.setProperty()" onkeypress="return preventEnter(event);"></textarea></dd>' + 2496 2462 '</dl>' + 2497 imagefunc(3, 3) +2498 2463 '</div>' + 2499 2464 '</div>';
