갤러리 소스에서 세로크기가 제어가 안되요 > 그누4 질문답변

그누4 질문답변

그누보드4 관련 질문은 QA 로 이전됩니다. QA 그누보드4 바로가기
기존 게시물은 열람만 가능합니다.

갤러리 소스에서 세로크기가 제어가 안되요 정보

갤러리 소스에서 세로크기가 제어가 안되요

첨부파일

list.skin.php (10.0K) 4회 다운로드 2006-12-31 05:10:32

본문

세로크기를 100으로 맞춰도.
무작정 커지네요.
 
파일첨부합니다.
 
 
주소입니다.
 
  • 복사

댓글 전체

이미지 싸이즈 고정소스 재공해드릴게요.

아래거는 서로다른 이미지를 원본이미지를 최소로 훼손하지 않고 같은 크기로 resize image 화 합니다. ... 출처~ 불명~

<?php

  $image = $_REQUEST['image'];
  $max_width = $_REQUEST['max_width'];
  $max_height = $_REQUEST['max_height'];

  if (!$max_width)
    $max_width = 80;
  if (!$max_height)
    $max_height = 60;

  $size = GetImageSize($image);
  $width = $size[0];
  $height = $size[1];

  $x_ratio = $max_width / $width;
  $y_ratio = $max_height / $height;

  if ( ($width <= $max_width) && ($height <= $max_height) ) {
    $tn_width = $width;
    $tn_height = $height;
  }
  else if (($x_ratio * $height) < $max_height) {
    $tn_height = ceil($x_ratio * $height);
    $tn_width = $max_width;
  }
  else {
    $tn_width = ceil($y_ratio * $width);
    $tn_height = $max_height;
  }

  $src = ImageCreateFromJpeg($image);
  $dst = ImageCreate($tn_width,$tn_height);
  ImageCopyResized($dst, $src, 0, 0, 0, 0,
      $tn_width,$tn_height,$width,$height);
  header('Content-type: image/jpeg');
  ImageJpeg($dst, null, -1);
  ImageDestroy($src);
  ImageDestroy($dst);

?>
사용방법....은  이미지 뿌려줄 곳에..아래처럼 하시면 돼요.

<?               
      // 이미지
        echo "<a href='{$list[$i][href]}'>";
        $image = urlencode($list[$i][file][0][file]);
        if (preg_match("/\.(gif|jpg|png)$/i", $image)) {
        echo '<img src="../m_shop/image_size.php?image=';
        echo "$g4[path]/data/file/$bo_table/$image";
        echo '&max_width=120&max_height=200" border=0  align = left>';
  echo "</a>";


      }
  else if (!file_exists($list[$i][file_image0])){
  echo "no image file";
  }
?>
© SIRSOFT
현재 페이지 제일 처음으로