diff --git a/res/values/non_localizable_custom.xml b/res/values/non_localizable_custom.xml
index 0db3a01c0..12e80b756 100644
--- a/res/values/non_localizable_custom.xml
+++ b/res/values/non_localizable_custom.xml
@@ -50,6 +50,8 @@
false
false
+ true
+
false
false
diff --git a/src/org/linphone/ChatFragment.java b/src/org/linphone/ChatFragment.java
index a54fde846..b7de1fa4e 100644
--- a/src/org/linphone/ChatFragment.java
+++ b/src/org/linphone/ChatFragment.java
@@ -634,6 +634,16 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC
}
}
+ private long hashBitmap(Bitmap bmp){
+ long hash = 31; // Random prime number
+ for(int x = 0; x < bmp.getWidth(); x++){
+ for (int y = 0; y < bmp.getHeight(); y++){
+ hash *= (bmp.getPixel(x,y) + 31);
+ }
+ }
+ return hash;
+ }
+
private String uploadImage(String filePath, Bitmap file, int compressorQuality, final int imageSize) {
String fileName;
if (filePath != null) {
@@ -643,6 +653,10 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC
fileName = getString(R.string.temp_photo_name_with_date).replace("%s", String.valueOf(System.currentTimeMillis()));
}
+ if (getResources().getBoolean(R.bool.hash_images_as_name_before_upload)) {
+ fileName = String.valueOf(hashBitmap(file)) + ".jpg";
+ }
+
String response = null;
HttpURLConnection conn = null;
try {