Browse Source

Calculate checksum before adding it to the database

Tobias Reich 9 years ago
parent
commit
936c2d0344
1 changed files with 5 additions and 1 deletions
  1. 5 1
      php/modules/Photo.php

+ 5 - 1
php/modules/Photo.php

@@ -113,6 +113,10 @@ class Photo extends Module {
 				}
 			}
 
+			# Calculate checksum
+			$checksum = sha1_file($path);
+			if ($checksum===false) $checksum = '';
+
 			# Read infos
 			$info = $this->getInfo($path);
 
@@ -159,7 +163,7 @@ class Photo extends Module {
 					'" . $albumID . "',
 					'" . $public . "',
 					'" . $star . "',
-					'" . sha1_file($path) . "');";
+					'" . $checksum . "');";
 			$result = $this->database->query($query);
 
 			if (!$result) {