[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와 관련된 팁을 여러분들과 함께 공유하세요.
나누면 즐거움이 커집니다.
나누면 즐거움이 커집니다.
| 번호 | 제목 | 글쓴이 | 날짜 | 조회 |
|---|---|---|---|---|
| 3169 | 12년 전 | 11449 | ||
| 3168 | 12년 전 | 8363 | ||
| 3167 | 12년 전 | 9524 | ||
| 3166 | 12년 전 | 8624 | ||
| 3165 | 12년 전 | 3853 | ||
| 3164 | 12년 전 | 5780 | ||
| 3163 | 12년 전 | 5485 | ||
| 3162 | 12년 전 | 7512 | ||
| 3161 |
다케미카코
|
12년 전 | 5657 | |
| 3160 | 12년 전 | 5980 | ||
| 3159 | 12년 전 | 5823 | ||
| 3158 | 12년 전 | 4214 | ||
| 3157 |
izabella
|
12년 전 | 8331 | |
| 3156 | 12년 전 | 6299 | ||
| 3155 | 12년 전 | 3783 | ||
| 3154 | 12년 전 | 8915 | ||
| 3153 | 12년 전 | 3597 | ||
| 3152 |
다케미카코
|
12년 전 | 6562 | |
| 3151 | 12년 전 | 5431 | ||
| 3150 |
|
12년 전 | 4803 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기