회원가입시 회원사진 첨부할때요 _ 사진을 섬네일 생성 도와주실분욤~~ 정보
회원가입시 회원사진 첨부할때요 _ 사진을 섬네일 생성 도와주실분욤~~
본문
// 회원 이미지 삭제
$profile_image_path = "{$g4['path']}/data/profile_image/{$mb_id}";
// 회원 썸네일 삭제
$profile_thumb_path = "{$g4['path']}/data/profile_image/thumb/{$mb_id}";
if( file_exists($profile_image_path) && $profile_image_del ) {
@unlink($profile_image_path);
@unlink($profile_thumb_path);
}
// 회원 이미지 체크
$profile_image = $_FILES['profile_image']['tmp_name'];
$profile_image_size = $_FILES['profile_image']['size'];
if( $profile_image_size ) {
// 가로 사이즈
$profile_image_width = "80";
// 세로 사이즈
$profile_image_height = "80";
// 크기
$profile_image_size = "1048576";
// 이미지 가로, 세로 및 mime 정보 로드
$get_image_size = getimagesize($profile_image);
// 정보가 없을 경우 이미지가 아님
if( empty($get_image_size) )
alert("이미지 파일만 업로드 가능합니다.");
// MINE 값을 검사하여 PNG, GIF, JPG 만 업로드 가능하게 함
$image_type = array('image/png', 'image/jpeg', 'image/gif');
if( !in_array($get_image_size['mime'], $image_type) )
alert("회원 이미지는 jpg, gif, png 형식만 업로드 가능합니다.".$get_image_size['mime']);
/*
if( $profile_image_width != 0 && $get_image_size[0] > $profile_image_width )
alert("회원 이미지의 가로 사이즈가 {$profile_image_width}픽셀 보다 큽니다.");
if( $profile_image_height != 0 && $get_image_size[1] > $profile_image_height )
alert("회원 이미지의 세로 사이즈가 {$profile_image_height}픽셀 보다 큽니다.");
*/
if( $profile_image_size != 0 && $profile_image_size > $profile_image_size )
alert("회원 이미지의 용량이 ".number_format($profile_image_size)." byte 보다 큽니다.");
// 회원 이미지를 MySQL 에 삽입하기 위해 BLOB 타입으로 변환
//$profile_image = addslashes(fread(fopen($profile_image, "r"), $profile_image_size));
$profile_image_path = "{$g4['path']}/data/profile_image";
if( !is_dir($profile_image_path) )
alert('디렉토리가 존재하지 않습니다.');
$profile_image_file = "{$profile_image_path}/{$mb_id}";
// 업로드가 안된다면 에러메세지 출력하고 죽어버립니다.
$error_code = move_uploaded_file($profile_image, $profile_image_file) or die($_FILES['profile_image']['error']);
// 올라간 파일의 퍼미션을 변경합니다.
chmod($profile_image_file, 0606);
}
?>
>>> 현재는 멥머id 로 섬네일이 생성됩니다~~
문제는 없는데 회원관리에서 엑셀로 사진을 뽑을려고하는데요 원본크기가 나와버려서요
사이즈에 맞쳐서 섬네일을 생성해야 아무래도 엑셀에서 높이같이 일정하게
정해줄수 있을것같은데요~~
>> 섬네일 80 x 80으로 생성하는데 도와주실분욤~~
$profile_image_path = "{$g4['path']}/data/profile_image/{$mb_id}";
// 회원 썸네일 삭제
$profile_thumb_path = "{$g4['path']}/data/profile_image/thumb/{$mb_id}";
if( file_exists($profile_image_path) && $profile_image_del ) {
@unlink($profile_image_path);
@unlink($profile_thumb_path);
}
// 회원 이미지 체크
$profile_image = $_FILES['profile_image']['tmp_name'];
$profile_image_size = $_FILES['profile_image']['size'];
if( $profile_image_size ) {
// 가로 사이즈
$profile_image_width = "80";
// 세로 사이즈
$profile_image_height = "80";
// 크기
$profile_image_size = "1048576";
// 이미지 가로, 세로 및 mime 정보 로드
$get_image_size = getimagesize($profile_image);
// 정보가 없을 경우 이미지가 아님
if( empty($get_image_size) )
alert("이미지 파일만 업로드 가능합니다.");
// MINE 값을 검사하여 PNG, GIF, JPG 만 업로드 가능하게 함
$image_type = array('image/png', 'image/jpeg', 'image/gif');
if( !in_array($get_image_size['mime'], $image_type) )
alert("회원 이미지는 jpg, gif, png 형식만 업로드 가능합니다.".$get_image_size['mime']);
/*
if( $profile_image_width != 0 && $get_image_size[0] > $profile_image_width )
alert("회원 이미지의 가로 사이즈가 {$profile_image_width}픽셀 보다 큽니다.");
if( $profile_image_height != 0 && $get_image_size[1] > $profile_image_height )
alert("회원 이미지의 세로 사이즈가 {$profile_image_height}픽셀 보다 큽니다.");
*/
if( $profile_image_size != 0 && $profile_image_size > $profile_image_size )
alert("회원 이미지의 용량이 ".number_format($profile_image_size)." byte 보다 큽니다.");
// 회원 이미지를 MySQL 에 삽입하기 위해 BLOB 타입으로 변환
//$profile_image = addslashes(fread(fopen($profile_image, "r"), $profile_image_size));
$profile_image_path = "{$g4['path']}/data/profile_image";
if( !is_dir($profile_image_path) )
alert('디렉토리가 존재하지 않습니다.');
$profile_image_file = "{$profile_image_path}/{$mb_id}";
// 업로드가 안된다면 에러메세지 출력하고 죽어버립니다.
$error_code = move_uploaded_file($profile_image, $profile_image_file) or die($_FILES['profile_image']['error']);
// 올라간 파일의 퍼미션을 변경합니다.
chmod($profile_image_file, 0606);
}
?>
>>> 현재는 멥머id 로 섬네일이 생성됩니다~~
문제는 없는데 회원관리에서 엑셀로 사진을 뽑을려고하는데요 원본크기가 나와버려서요
사이즈에 맞쳐서 섬네일을 생성해야 아무래도 엑셀에서 높이같이 일정하게
정해줄수 있을것같은데요~~
>> 섬네일 80 x 80으로 생성하는데 도와주실분욤~~
댓글 전체