[JAVASCRIPT] 에디터 사이즈 줄이기 속도빠른..
$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); 이부분 원하는 사이즈로 변경 하세요..
먼저 배열 두개있죠? 똑같은배열 둘다 에디터에서 받아오는 값으로 교체해주세요
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와 관련된 팁을 여러분들과 함께 공유하세요.
나누면 즐거움이 커집니다.
나누면 즐거움이 커집니다.
| 번호 | 제목 | 글쓴이 | 날짜 | 조회 |
|---|---|---|---|---|
| 3149 | 12년 전 | 11353 | ||
| 3148 | 12년 전 | 12514 | ||
| 3147 | 12년 전 | 4348 | ||
| 3146 | 12년 전 | 11162 | ||
| 3145 |
takumi22
|
12년 전 | 11255 | |
| 3144 | 12년 전 | 5485 | ||
| 3143 | 12년 전 | 10372 | ||
| 3142 | 12년 전 | 9631 | ||
| 3141 | 12년 전 | 4372 | ||
| 3140 | 12년 전 | 3471 | ||
| 3139 |
adm1n
|
12년 전 | 5266 | |
| 3138 | 12년 전 | 6398 | ||
| 3137 | 12년 전 | 5645 | ||
| 3136 |
izabella
|
12년 전 | 6442 | |
| 3135 |
|
12년 전 | 5889 | |
| 3134 |
|
12년 전 | 5070 | |
| 3133 | 12년 전 | 6603 | ||
| 3132 | 12년 전 | 14649 | ||
| 3131 | 12년 전 | 7377 | ||
| 3130 | 12년 전 | 5399 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기