일반 이미지는 등록시 자동으로 리사이즈 되는데요
gif는 리사이즈 되지 않고 그대로 올라가게 됩니다.
XETOWN 에서도 테스트 해보니 마찬가지네요.
그래서 그런지 고용량의 프로필 이미지를 올리시는 분들때문에 곤란합니다.
용량이 6메가 이상의 고용량의 프로필을 쓰다보니 댓글 쓰실때 나오는
프로필 사진이 나와서 그런분 몇분이 댓글만 써도 용량이 엄청 잡아먹게 됩니다.
서버도 느리게 할뿐더러 사용자한테도 데이터 부담을 주고 있습니다.
GIF를 제한하거나 GIF도 리사이즈 할 방법이 없을까요?
댓글 21
<-- 테스트를 위해 6메가 gif 프로필 사진을 업로드한 상태입니다.
해결되어 프로필 삭제 하였습니다.
누가 이것 개선좀 시켜줬으면 좋겠습니다.
ex) 90픽셀로 제한이 되어 업로드한 파일은 프로필이미지로 사용이 불가능합니다.
찾아보니 90 x 90 이상은 자동리사이즈 되게 되어있는데 언제부터 생긴 오류인지 그대로 유지된듯 합니다.
이미지닉네임은 90 x 20 이상일때 GIF도 리사이즈가 정상 작동하는군요
하지만 언제부터인가 리사이즈 자체가 안되는 현사이 발생하고있는 듯 합니다.
테스트 해보니 이미지닉네임은 GIF 등록시 일정크기(90x20로 예상됨)까지는 그대로고 그이상은 자동으로 리사이즈 되네요
member.controller.php 파일에 이미지닉네임 리사이즈 부분인데요
이걸 프로필에 이용하면 될듯 한데... 어떻게 해야 할까요?
========================================================
이미지닉네임 리사이즈 부분
function insertImageName($member_srl, $target_file)
{
// Check uploaded file
if(!checkUploadedFile($target_file)) return;
$oModuleModel = getModel('module');
$config = $oModuleModel->getModuleConfig('member');
// Get an image size
$max_width = $config->image_name_max_width;
if(!$max_width) $max_width = "90";
$max_height = $config->image_name_max_height;
if(!$max_height) $max_height = "20";
// Get a target path to save
$target_path = sprintf('files/member_extra_info/image_name/%s/', getNumberingPath($member_srl));
FileHandler::makeDir($target_path);
$target_filename = sprintf('%s%d.gif', $target_path, $member_srl);
// Get file information
list($width, $height, $type, $attrs) = @getimagesize($target_file);
// Convert if the image size is larger than a given size or if the format is not a gif
if($width > $max_width || $height > $max_height || $type!=1) FileHandler::createImageFile($target_file, $target_filename, $max_width, $max_height, 'gif');
else @copy($target_file, $target_filename);
}
========================================
프로필 리사이즈 부분
function insertProfileImage($member_srl, $target_file)
{
// Check uploaded file
if(!checkUploadedFile($target_file)) return;
$oMemberModel = getModel('member');
$config = $oMemberModel->getMemberConfig();
// Get an image size
$max_width = $config->profile_image_max_width;
if(!$max_width) $max_width = "90";
$max_height = $config->profile_image_max_height;
if(!$max_height) $max_height = "90";
// Get a target path to save
$target_path = sprintf('files/member_extra_info/profile_image/%s', getNumberingPath($member_srl));
FileHandler::makeDir($target_path);
// Get file information
list($width, $height, $type, $attrs) = @getimagesize($target_file);
if(IMAGETYPE_PNG == $type) $ext = 'png';
elseif(IMAGETYPE_JPEG == $type) $ext = 'jpg';
elseif(IMAGETYPE_GIF == $type) $ext = 'gif';
else
{
return;
}
FileHandler::removeFilesInDir($target_path);
$target_filename = sprintf('%s%d.%s', $target_path, $member_srl, $ext);
// Convert if the image size is larger than a given size or if the format is not a gif
if(($width > $max_width || $height > $max_height ) && $type != 1)
{
FileHandler::createImageFile($target_file, $target_filename, $max_width, $max_height, $ext);
}
else
{
@copy($target_file, $target_filename);
}
}
감사합니다 이제 관리자가 설정한 이미지 이상 넘으면 자동 리시즈 작동이 잘됩니다.
용량 문제도 해결되어야 완벽하겠지만 일단 이미지 사이즈 제한으로 용량이 조금이라도 줄어들듯 합니다.
일단 간단한 코어수정 방법은 바로 위 댓글을 참고하시고요...
가로세로 크기는 작지만 재생 시간이 길어서 용량이 큰 GIF 이미지라든지, 이런 문제가 여전히 남아 있기 때문에 장기적으로는 더 확실한 해결책이 필요할 것 같습니다. 무조건 줄여버리면 간단한 GIF도 사용할 수 없게 되는 문제가 생기거든요.
아.. 프로필 이미지는 이미지매직이 관여를 못하겠군요. 이미지프로세서에서 옵션에서 제가 이미지매직을 선택해 줬다는 것을 깜빡 했네요 ㅋㅋ
일단 예전처럼 리사이즈만 해주고 움짤이 사라지면 회원들이 사이즈 맞춰서 업로드하려는 시도는 하게 되니 예전 방식이 운영자에게도 도움이 되는 방식 일 듯 합니다.
프로필 수정후 용량 큰거 찾아 지우고 있는데 어마무시하네요
2MB , 6MB , 12MB, 15MB 짜리 프로필 이미지가 계속 나오네요 ㄷㄷ
1MB 이상 프로필 사진만 지워도 트래픽이 상당히 줄어것 같아요