묻고답하기

최근이미지를 출력하면서 궁금한게 있어서 질문드립니다.

이미지 가로 갯수를 기본값인 5개로 했을 때나 10개, 20개로 늘렸을 때나 항상 고정된 크기의 이미지 출력방법을 알고 싶습니다.

질문이 애매한 거 같아서 부연설명을 하자면 이미지의 가로 숫자와 관계없이 코드출력시 생성된 이미지의 가로 크기를 유지할 수 있는 방법을 찾고 있는 것입니다.

현재는 이미지 가로 숫자를 늘리면 그것을 게시판 크기에 맞게 각각의 이미지 가로크기를 축소하는데, 이렇게 축소되지 않는 방법에 대해 문의드립니다.

아래는 ../widgets/newest_images/newest_images.class.php 파일입니다.

제 생각에는 게시판 넓이를 이미지 가로 숫자로 나눠줄 것 같은데 워낙 문외한이다보니 어느부분인지를 모르겠네요.

바쁘시더라도 부탁 좀 드리겠습니다.

모두들 좋은 밤 되시기 바랍니다.

 

<?php
    /**
     * @class newest_images
     * @author zero (zero@nzeo.com)
     * @brief 최근 이미지를 출력하는 위젯
     * @version 0.1
     **/

    class newest_images extends WidgetHandler {

        /**
         * @brief 위젯의 실행 부분
         *
         * ./widgets/위젯/conf/info.xml 에 선언한 extra_vars를 args로 받는다
         * 결과를 만든후 print가 아니라 return 해주어야 한다
         **/
        function proc($args) {
            // 글자 제목 길이
            $widget_info->title_length = (int)$args->title_length;
            if(!$widget_info->title_length) $widget_info->title_length = 10;

            // 썸네일 생성 방법
            $widget_info->thumbnail_type = $args->thumbnail_type;
            if(!$widget_info->thumbnail_type) $widget_info->thumbnail_type = 'crop';

            // 썸네일 가로 크기
            $widget_info->thumbnail_width = (int)$args->thumbnail_width;
            if(!$widget_info->thumbnail_width) $widget_info->thumbnail_width = 100;

            // 썸네일 세로 크기
            $widget_info->thumbnail_height = (int)$args->thumbnail_height;
            if(!$widget_info->thumbnail_height) $widget_info->thumbnail_height = 100;

            // 세로 이미지 수
            $widget_info->rows_list_count = (int)$args->rows_list_count;
            if(!$widget_info->rows_list_count) $widget_info->rows_list_count = 1;

            // 가로 이미지 수
            $widget_info->cols_list_count = (int)$args->cols_list_count;
            if(!$widget_info->cols_list_count) $widget_info->cols_list_count = 5;

            // 노출 여부 체크
            if($args->display_author!='Y') $widget_info->display_author = 'N';
            else $widget_info->display_author = 'Y';
            if($args->display_regdate!='Y') $widget_info->display_regdate = 'N'+ '+ ';
            else $widget_info->display_regdate = 'Y';
            if($args->display_readed_count!='Y') $widget_info->display_readed_count = 'N';
            else $widget_info->display_readed_count = 'Y';
            if($args->display_voted_count!='Y') $widget_info->display_voted_count = 'N';
            else $widget_info->display_voted_count = 'Y';

            // 제목
            $widget_info->title = $args->title;

            // 대상 모듈 정리
            $mid_list = explode(",",$args->mid_list);

            // 템플릿 파일에서 사용할 변수들을 세팅
            if(count($mid_list)==1) $widget_info->module_name = $mid_list[0];

            // 변수 정리
            $obj->list_count = $widget_info->rows_list_count * $widget_info->cols_list_count;

            // mid에 해당하는 module_srl을 구함
            $oModuleModel = &getModel('module');
            $module_srl_list = $oModuleModel->getModuleSrlByMid($mid_list);
            if(is_array($module_srl_list)) $obj->module_srls = implode(",",$module_srl_list);
            else $obj->module_srls = $module_srl_list;
            $obj->direct_download = 'Y';
            $obj->isvalid = 'Y';

            $oDocumentModel = &getModel('document');

            // 정해진 모듈에서 문서별 파일 목록을 구함
   
$obj->category_srl = $args->category_srl;   
$files_output = executeQueryArray("file.getOneFileInDocument", $obj);
$files_count = count($files_output->data);

            $document_srl_list = array();
            $document_list = array();

            if($files_count>0) {
                for($i=0;$i<$files_count;$i++) $document_srl_list[] = $files_output->data[$i]->document_srl;

                $tmp_document_list = $oDocumentModel->getDocuments($document_srl_list);
                if(count($tmp_document_list)) {
                    foreach($tmp_document_list as $val) $document_list[] = $val;
                }
            }

            $document_count = count($document_list);
            $total_count = $widget_info->rows_list_count * $widget_info->cols_list_count;
            for($i=$document_count;$i<$total_count;$i++) $document_list[] = new DocumentItem();
            $widget_info->document_list = $document_list;

            Context::set('widget_info', $widget_info);

            // 템플릿의 스킨 경로를 지정 (skin, colorset에 따른 값을 설정)
            $tpl_path = sprintf('%sskins/%s', $this->widget_path, $args->skin);
            Context::set('colorset', $args->colorset);

            // 템플릿 파일을 지정
            $tpl_file = 'list';

            // 템플릿 컴파일
            $oTemplate = &TemplateHandler::getInstance();
            $output = $oTemplate->compile($tpl_path, $tpl_file);
            return $output;
        }
    }
?>

 

 

혹시 몰라서 ../newest_images/skins/default/list.html 파일도 올려봅니다.

 

<!--// 설정된 컬러셋의 종류에 따라서 css파일을 import 합니다 -->

<!--@if($colorset=="normal"||!$colorset)-->
    <!--%import("css/normal.css")-->
<!--@end-->

<div class="ni_box">
    <title">!--@if($widget_info->title)-->
    <div class="title_box">
        <div class="title">{$widget_info->title}</div>
        <module_name">!--@if($widget_info->module_name)-->
        <div class="more"><a href="{getUrl('','+ 'mid'+ ',$widget_info->module_name)}">more</a></div>
        <!--@end-->
    </div>
    <!--@end-->

    <document_list">!--@if(count($widget_info->document_list))-->
        <table class="thumbnail_box">
        {@ $count = 0; }
        <rows_list_count;$i">!--@for($i=0;$i<$widget_info->rows_list_count;$i++)-->
        <tr valign="top">
            <cols_list_count;$j">!--@for($j=0;$j<$widget_info->cols_list_count;$j++)-->
                {@ $oDocument = $widget_info->document_list[$i*$widget_info->cols_list_count + $j]}
            <td <rows_list_count>1)-->class="bottomBorder"[{$oDocument->getCommentCount()}]&nbsp;

글쓴이 제목 최종 글
XE 공지 글 쓰기,삭제 운영방식 변경 공지 [16] 2019.03.05 by 남기남
허접영맨 내컴에 ftp서버만들어서 실행시 웹에서 설치가안되요;;ㅠㅠ [2] file 2008.03.11 by 영맨
의대생 안녕하세요. 게시판 질문 입니다^^  
알수없는오류 하위메뉴의 [+] 표시가 뜨지 않습니다. file  
안원석334 레이아웃에서 메뉴의 언어별 값을 가지고 오려면 어떻게 합니까? ^^ [1] 2008.03.11 by SensePlus1
WarYi 댓글 접어서 페이지 띄우는 방법은 없을까요?  
연군 DOCTYPE 수정은 어디서 가능한가요...??? [1] 2008.03.12 by 연군
taenie 이미지 본문 삽입  
샤오린 PHP에 대해 질문 드립니다. [1] 2008.03.12 by rhythm*
영달이 애플스킨 질문이있습니다~ [1] file 2008.03.12 by 우야노닷컴
이진규665 설치 마지막 등록이 안됩니다. 도와주세요 file  
mmx900 RAW 액션?같은 게 있을까요  
임수형 분류 추가가 안됩니다 file  
모든배려 게시판 백업 말고 홈페이지를 통으로 백업가능한가요.  
라르게덴 고수님들 document_controller.php 파일 소스에 대해 질문... [2] 2008.03.12 by 라르게덴
데미 게시물 수정했을때 뜨는 U마크 있잖아요..  
flowerrain 파이어폭스에서 로고이미지의 위치가 다르게 나타납니다. [2] file 2008.03.12 by flowerrain
붉게파란 게시판관리>추가설정>권한관리 부분에서..질문입니다. file  
조재민987 재설치를 했더니 로그인이 되지 않습니다;;  
likesea 설치문의  
엠비 RSS 게시물 웹진형으로 뽑아오기