B

[JAVASCRIPT] 에디터 사이즈 줄이기 속도빠른..

· 12년 전 · 4499
$rs['PL_Contents'] = preg_replace("/(\<img )([^\>]*)(\>)/i", "\\1 name='target_resize_image[]' onclick='image_window(this)' style='cursor:pointer;' \\2 \\3", $rs['PL_Contents']);

먼저 배열 두개있죠? 똑같은배열 둘다 에디터에서 받아오는 값으로 교체해주세요
rs['PL_Contents'] 요거요..

그리고 출력을 하나 해줍시다.
<span id="writeContents"><?=$rs['PL_Contents'];?></span>

아직 다된거 아니에요..

<script language="JavaScript">
function resizeBoardImage(imageWidth, borderColor) {

var target = document.getElementsByName('target_resize_image[]');
var imageHeight = 0;

if (target) {
for(i=0; i<target.length; i++) {
// 원래 사이즈를 저장해 놓는다
target[i].tmp_width = target[i].width;
target[i].tmp_height = target[i].height;
// 이미지 폭이 테이블 폭보다 크다면 테이블폭에 맞춘다
if(target[i].width > imageWidth) {
imageHeight = parseFloat(target[i].width / target[i].height)
target[i].width = imageWidth;
target[i].height = parseInt(imageWidth / imageHeight);
target[i].style.cursor = '';

// 스타일에 적용된 이미지의 폭과 높이를 삭제한다
target[i].style.width = '';
target[i].style.height = '';
}

if (borderColor) {
target[i].style.borderWidth = '1px';
target[i].style.borderStyle = 'solid';
target[i].style.borderColor = borderColor;
}
}
}
}

</script>
<? $content_table_width= $right_table_width-20; ?>
<script type="text/javascript">
try { window.attachEvent("onload", boardImageResize); }
catch (e) { window.addEventListener("load", boardImageResize, false); }
function boardImageResize() {
resizeBoardImage(500);
}
</script>

이제 작동될껍니다.
resizeBoardImage(500); 이부분 원하는 사이즈로 변경 하세요..
|
댓글을 작성하시려면 로그인이 필요합니다. 로그인

그누4 팁자료실

그누보드4와 관련된 팁을 여러분들과 함께 공유하세요. 나누면 즐거움이 커집니다.

+
제목 글쓴이 날짜 조회
12년 전 조회 1.1만
12년 전 조회 1.1만
12년 전 조회 3,069
12년 전 조회 2.4만
12년 전 조회 5,186
12년 전 조회 5,288
12년 전 조회 3,764
12년 전 조회 7,284
12년 전 조회 4,201
12년 전 조회 4,500
12년 전 조회 4,535
12년 전 조회 2,657
12년 전 조회 9,818
12년 전 조회 2.2만
12년 전 조회 6,178
12년 전 조회 3,860
12년 전 조회 4,167
12년 전 조회 3,772
12년 전 조회 3,929
12년 전 조회 5,783
🐛 버그신고