묻고답하기

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

이미지 가로 갯수를 기본값인 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 남기남
밍구43 답변에 채택 버튼을 만들어 채택이 되면 다른 게시판으로 글을 이동할 수 있을까요? (지식인 게시판 아님)  
날아라치킨 게시판 설정...  
ePeMJF 회원이 글/댓글을 남기면 모든 회원에게 메일을 보내도록 하고 싶습니다.  
sorimom 어디서부터어떻게 해야할지..  
날아라치킨 스크롤바수정  
야고비 또 다시 부탁드립니다. 최근 글(Content) 위젯이 안됩니다. 부디 절 좀 도와주세요.. 감사합니다  
김택형 쉬운설치 도중에 오류가 생겼어요!  
hwang2009 왜 제 컴퓨터에서만 만들어놓은 웹사이트에 안들어 가지는 것일까요?  
은아휘 가입폼 수정을 하면 header 부분이 깨져 나옵니다.  
날마다좋은날 xe-xe로 데이터 이전 하는 방법을 배우고져 합니다. [1] 2010.12.26 by 언약
박노열 게시글 관리가 나타나지 않습니다. 어떻게 해야 합니까? [1] file 2010.12.26 by 박노열
다프린 XML 퀴리 질문..  
치퐁 댓글페이지 넘기는 버튼이 출력되지않아요 [1] file 2010.12.27 by 치퐁
안수완 로컬에서 사이트를 만들어서 웹에 셋팅하는 방법 [1] 2010.12.27 by NineTail
마리모 module.xml을 쓸 때 admin action에 대해 질문드립니다. [1] 2010.12.27 by SMaker
이종철243 로그인 정보가 있는 sessions의 위치? [2] 2010.12.27 by 이종철243
hexit 댓글부분 수정 가능한가요?  
ANILIFE 페이지 생성에서 시작페이지(기본페이지) 설정 [1] 2010.12.27 by 백성찬
김창우740 XE동의과정에서..한국어 선택후..문제.. [1] 2010.12.27 by Arp
마이콘 블로그의 글을 카피-붙여넣기해서 글을 쓰면 이미지가 깨지는데... [1] 2010.12.27 by Arp