| @@ 976-989 (lines=14) @@ | ||
| 973 | } |
|
| 974 | ||
| 975 | // This is the common name for the new photos. |
|
| 976 | if (KEEP_THE_NAME_WHEN_CHANGE_IMAGE && !empty($old_file)) { |
|
| 977 | $old_extension = strtolower(substr(strrchr($old_file, '.'), 1)); |
|
| 978 | $filename = in_array($old_extension, $allowed_types) ? substr($old_file, 0, -strlen($old_extension)) : $old_file; |
|
| 979 | $filename = (substr($filename, -1) == '.') ? $filename.$extension : $filename.'.'.$extension; |
|
| 980 | } else { |
|
| 981 | $filename = api_replace_dangerous_char($filename); |
|
| 982 | if (PREFIX_IMAGE_FILENAME_WITH_UID) { |
|
| 983 | $filename = uniqid('').'_'.$filename; |
|
| 984 | } |
|
| 985 | // We always prefix user photos with user ids, so on setting |
|
| 986 | // api_get_setting('split_users_upload_directory') === 'true' |
|
| 987 | // the correspondent directories to be found successfully. |
|
| 988 | $filename = $group_id.'_'.$filename; |
|
| 989 | } |
|
| 990 | ||
| 991 | // Storing the new photos in 4 versions with various sizes. |
|
| 992 | ||
| @@ 1108-1121 (lines=14) @@ | ||
| 1105 | } |
|
| 1106 | ||
| 1107 | // This is the common name for the new photos. |
|
| 1108 | if (KEEP_THE_NAME_WHEN_CHANGE_IMAGE && !empty($old_file)) { |
|
| 1109 | $old_extension = strtolower(substr(strrchr($old_file, '.'), 1)); |
|
| 1110 | $filename = in_array($old_extension, $allowed_types) ? substr($old_file, 0, -strlen($old_extension)) : $old_file; |
|
| 1111 | $filename = (substr($filename, -1) == '.') ? $filename.$extension : $filename.'.'.$extension; |
|
| 1112 | } else { |
|
| 1113 | $filename = api_replace_dangerous_char($filename); |
|
| 1114 | if (PREFIX_IMAGE_FILENAME_WITH_UID) { |
|
| 1115 | $filename = uniqid('').'_'.$filename; |
|
| 1116 | } |
|
| 1117 | // We always prefix user photos with user ids, so on setting |
|
| 1118 | // api_get_setting('split_users_upload_directory') === 'true' |
|
| 1119 | // the correspondent directories to be found successfully. |
|
| 1120 | $filename = $group_id.'_'.$filename; |
|
| 1121 | } |
|
| 1122 | ||
| 1123 | // Storing the new photos in 4 versions with various sizes. |
|
| 1124 | ||
| @@ 1625-1638 (lines=14) @@ | ||
| 1622 | } |
|
| 1623 | ||
| 1624 | // This is the common name for the new photos. |
|
| 1625 | if (KEEP_THE_NAME_WHEN_CHANGE_IMAGE && !empty($old_file)) { |
|
| 1626 | $old_extension = strtolower(substr(strrchr($old_file, '.'), 1)); |
|
| 1627 | $filename = in_array($old_extension, $allowed_types) ? substr($old_file, 0, -strlen($old_extension)) : $old_file; |
|
| 1628 | $filename = (substr($filename, -1) == '.') ? $filename.$extension : $filename.'.'.$extension; |
|
| 1629 | } else { |
|
| 1630 | $filename = api_replace_dangerous_char($filename); |
|
| 1631 | if (PREFIX_IMAGE_FILENAME_WITH_UID) { |
|
| 1632 | $filename = uniqid('').'_'.$filename; |
|
| 1633 | } |
|
| 1634 | // We always prefix user photos with user ids, so on setting |
|
| 1635 | // api_get_setting('split_users_upload_directory') === 'true' |
|
| 1636 | // the correspondent directories to be found successfully. |
|
| 1637 | $filename = $user_id.'_'.$filename; |
|
| 1638 | } |
|
| 1639 | ||
| 1640 | //Crop the image to adjust 1:1 ratio |
|
| 1641 | $image = new Image($source_file); |
|