| @@ 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 | ||
| @@ 1109-1122 (lines=14) @@ | ||
| 1106 | } |
|
| 1107 | ||
| 1108 | // This is the common name for the new photos. |
|
| 1109 | if (KEEP_THE_NAME_WHEN_CHANGE_IMAGE && !empty($old_file)) { |
|
| 1110 | $old_extension = strtolower(substr(strrchr($old_file, '.'), 1)); |
|
| 1111 | $filename = in_array($old_extension, $allowed_types) ? substr($old_file, 0, -strlen($old_extension)) : $old_file; |
|
| 1112 | $filename = (substr($filename, -1) == '.') ? $filename.$extension : $filename.'.'.$extension; |
|
| 1113 | } else { |
|
| 1114 | $filename = api_replace_dangerous_char($filename); |
|
| 1115 | if (PREFIX_IMAGE_FILENAME_WITH_UID) { |
|
| 1116 | $filename = uniqid('').'_'.$filename; |
|
| 1117 | } |
|
| 1118 | // We always prefix user photos with user ids, so on setting |
|
| 1119 | // api_get_setting('split_users_upload_directory') === 'true' |
|
| 1120 | // the correspondent directories to be found successfully. |
|
| 1121 | $filename = $group_id.'_'.$filename; |
|
| 1122 | } |
|
| 1123 | ||
| 1124 | // Storing the new photos in 4 versions with various sizes. |
|
| 1125 | ||
| @@ 1627-1640 (lines=14) @@ | ||
| 1624 | } |
|
| 1625 | ||
| 1626 | // This is the common name for the new photos. |
|
| 1627 | if (KEEP_THE_NAME_WHEN_CHANGE_IMAGE && !empty($old_file)) { |
|
| 1628 | $old_extension = strtolower(substr(strrchr($old_file, '.'), 1)); |
|
| 1629 | $filename = in_array($old_extension, $allowed_types) ? substr($old_file, 0, -strlen($old_extension)) : $old_file; |
|
| 1630 | $filename = (substr($filename, -1) == '.') ? $filename.$extension : $filename.'.'.$extension; |
|
| 1631 | } else { |
|
| 1632 | $filename = api_replace_dangerous_char($filename); |
|
| 1633 | if (PREFIX_IMAGE_FILENAME_WITH_UID) { |
|
| 1634 | $filename = uniqid('').'_'.$filename; |
|
| 1635 | } |
|
| 1636 | // We always prefix user photos with user ids, so on setting |
|
| 1637 | // api_get_setting('split_users_upload_directory') === 'true' |
|
| 1638 | // the correspondent directories to be found successfully. |
|
| 1639 | $filename = $user_id.'_'.$filename; |
|
| 1640 | } |
|
| 1641 | ||
| 1642 | //Crop the image to adjust 1:1 ratio |
|
| 1643 | $image = new Image($source_file); |
|