@@ 874-931 (lines=58) @@ | ||
871 | * |
|
872 | * @return void |
|
873 | */ |
|
874 | function insertImageName($member_srl, $target_file) |
|
875 | { |
|
876 | $oMemberModel = getModel('member'); |
|
877 | $config = $oMemberModel->getMemberConfig(); |
|
878 | $max_width = $config->image_name_max_width; |
|
879 | $max_height = $config->image_name_max_height; |
|
880 | $max_filesize = $config->image_name_max_filesize; |
|
881 | ||
882 | Context::loadLang(_XE_PATH_ . 'modules/file/lang'); |
|
883 | ||
884 | // Get a target path to save |
|
885 | $target_path = sprintf('files/member_extra_info/image_name/%s/', getNumberingPath($member_srl)); |
|
886 | FileHandler::makeDir($target_path); |
|
887 | ||
888 | $target_filename = sprintf('%s%d.gif', $target_path, $member_srl); |
|
889 | // Get file information |
|
890 | list($width, $height, $type) = @getimagesize($target_file); |
|
891 | // Convert if the image size is larger than a given size or if the format is not a gif |
|
892 | if($width > $max_width || $height > $max_height || $type!=1) |
|
893 | { |
|
894 | $temp_filename = sprintf('files/cache/tmp/image_name_%d.gif', $member_srl, $ext); |
|
895 | FileHandler::createImageFile($target_file, $temp_filename, $max_width, $max_height, 'gif'); |
|
896 | ||
897 | // 파일 용량 제한 |
|
898 | FileHandler::clearStatCache($temp_filename); |
|
899 | $filesize = filesize($temp_filename); |
|
900 | if($max_filesize && $filesize > ($max_filesize * 1024)) |
|
901 | { |
|
902 | FileHandler::removeFile($temp_filename); |
|
903 | return $this->stop(implode(' ' , array( |
|
904 | Context::getLang('msg_not_uploaded_image_name'), |
|
905 | Context::getLang('msg_exceeds_limit_size') |
|
906 | ))); |
|
907 | } |
|
908 | ||
909 | FileHandler::removeFilesInDir($target_path); |
|
910 | FileHandler::moveFile($temp_filename, $target_filename); |
|
911 | FileHandler::clearStatCache($target_filename); |
|
912 | } |
|
913 | else |
|
914 | { |
|
915 | // 파일 용량 제한 |
|
916 | $filesize = filesize($target_file); |
|
917 | if($max_filesize && $filesize > ($max_filesize * 1024)) |
|
918 | { |
|
919 | return $this->stop(implode(' ' , array( |
|
920 | Context::getLang('msg_not_uploaded_image_name'), |
|
921 | Context::getLang('msg_exceeds_limit_size') |
|
922 | ))); |
|
923 | } |
|
924 | ||
925 | FileHandler::removeFilesInDir($target_path); |
|
926 | @copy($target_file, $target_filename); |
|
927 | FileHandler::clearStatCache($target_filename); |
|
928 | } |
|
929 | ||
930 | return new BaseObject(0, 'success'); |
|
931 | } |
|
932 | ||
933 | /** |
|
934 | * Delete profile image |
|
@@ 1017-1073 (lines=57) @@ | ||
1014 | * |
|
1015 | * @return void |
|
1016 | */ |
|
1017 | function insertImageMark($member_srl, $target_file) |
|
1018 | { |
|
1019 | $oMemberModel = getModel('member'); |
|
1020 | $config = $oMemberModel->getMemberConfig(); |
|
1021 | $max_width = $config->image_mark_max_width; |
|
1022 | $max_height = $config->image_mark_max_height; |
|
1023 | $max_filesize = $config->image_mark_max_filesize; |
|
1024 | ||
1025 | Context::loadLang(_XE_PATH_ . 'modules/file/lang'); |
|
1026 | ||
1027 | $target_path = sprintf('files/member_extra_info/image_mark/%s/', getNumberingPath($member_srl)); |
|
1028 | FileHandler::makeDir($target_path); |
|
1029 | ||
1030 | $target_filename = sprintf('%s%d.gif', $target_path, $member_srl); |
|
1031 | // Get file information |
|
1032 | list($width, $height, $type, $attrs) = @getimagesize($target_file); |
|
1033 | ||
1034 | if($width > $max_width || $height > $max_height || $type!=1) |
|
1035 | { |
|
1036 | $temp_filename = sprintf('files/cache/tmp/image_mark_%d.gif', $member_srl); |
|
1037 | FileHandler::createImageFile($target_file, $temp_filename, $max_width, $max_height, 'gif'); |
|
1038 | ||
1039 | // 파일 용량 제한 |
|
1040 | FileHandler::clearStatCache($temp_filename); |
|
1041 | $filesize = filesize($temp_filename); |
|
1042 | if($max_filesize && $filesize > ($max_filesize * 1024)) |
|
1043 | { |
|
1044 | FileHandler::removeFile($temp_filename); |
|
1045 | return $this->stop(implode(' ' , array( |
|
1046 | Context::getLang('msg_not_uploaded_group_image_mark'), |
|
1047 | Context::getLang('msg_exceeds_limit_size') |
|
1048 | ))); |
|
1049 | } |
|
1050 | ||
1051 | FileHandler::removeFilesInDir($target_path); |
|
1052 | FileHandler::moveFile($temp_filename, $target_filename); |
|
1053 | FileHandler::clearStatCache($target_filename); |
|
1054 | } |
|
1055 | else |
|
1056 | { |
|
1057 | $filesize = filesize($target_file); |
|
1058 | if($max_filesize && $filesize > ($max_filesize * 1024)) |
|
1059 | { |
|
1060 | FileHandler::removeFile($target_file); |
|
1061 | return $this->stop(implode(' ' , array( |
|
1062 | Context::getLang('msg_not_uploaded_group_image_mark'), |
|
1063 | Context::getLang('msg_exceeds_limit_size') |
|
1064 | ))); |
|
1065 | } |
|
1066 | ||
1067 | FileHandler::removeFilesInDir($target_path); |
|
1068 | @copy($target_file, $target_filename); |
|
1069 | FileHandler::clearStatCache($target_filename); |
|
1070 | } |
|
1071 | ||
1072 | return new BaseObject(0, 'success'); |
|
1073 | } |
|
1074 | ||
1075 | /** |
|
1076 | * Delete Image Mark |