썸네일 요고 색이 가네~
어찌 해야 될까?
$image_file_path="NSX.jpg";// : 변경전 이미지가 저장되어 있는 경로
$new_image_file_path="file/NSX.jpg";// : 썸네일 이미지가 저장될 디렉토리 경로
$max_width=300;// : 변경할 이미지의 폭
$max_height=200;// : 변경할 이미지의 높이
$return_val = 1;
$return_val = ( ($img = ImageCreateFromJPEG ( $image_file_path )) && $return_val == 1 ) ? "1" : "0";
$FullImage_width = imagesx ($img); // Original image width
$FullImage_height = imagesy ($img); // Original image height
$ratio = ( $FullImage_width > $max_width ) ? (real)($max_width / $FullImage_width) : 1 ;
$new_width = ((int)($FullImage_width * $ratio)); //full-size width
$new_height = ((int)($FullImage_height * $ratio)); //full-size height
$ratio = ( $new_height > $max_height ) ? (real)($max_height / $new_height) : 1 ;
$new_width = ((int)($new_width * $ratio)); //mid-size width
$new_height = ((int)($new_height * $ratio)); //mid-size height
if ( $new_width == $FullImage_width && $new_height == $FullImage_height )
copy ( $image_file_path, $new_image_file_path );
$full_id = ImageCreate( $new_width , $new_height );
ImageCopyResized( $full_id, $img, 0,0, 0,0, $new_width, $new_height, $FullImage_width, $FullImage_height );
$return_val = ( $full = ImageJPEG( $full_id, $new_image_file_path, 100 ) && $return_val == 1 ) ? "1" : "0";
ImageCreate => ImageCreateTrueColor
좀더 업글해야지....


0