diff --git a/docs/NEWS b/docs/NEWS
index 2792e7a0..d9c9934b 100644
--- a/docs/NEWS
+++ b/docs/NEWS
@@ -3,6 +3,10 @@
Version 1.6 ()
------------------------------------------------------------------------
+ * Fixed a bug in synchronizing new files with the same basename
+ but different extensions, where files with the same mimetype
+ would not get added (garvinhicking)
+
* Show subscription status of comments in frontend and backend
* Added ability to report spam/ham to akismet (Black Warthog)
diff --git a/include/functions_images.inc.php b/include/functions_images.inc.php
index 53276f0b..f1df6b3b 100644
--- a/include/functions_images.inc.php
+++ b/include/functions_images.inc.php
@@ -573,7 +573,7 @@ function serendipity_insertImageInDatabase($filename, $directory, $authorid = 0,
serendipity_db_escape_string($directory),
serendipity_db_escape_string($realname)
);
-
+
$sql = serendipity_db_query($query);
if (is_string($sql)) {
echo $query . '
';
@@ -1152,15 +1152,17 @@ function serendipity_syncThumbs($deleteThumbs = false) {
$cond = array(
'and' => "WHERE name = '" . serendipity_db_escape_string($fbase) . "'
" . ($fdir != '' ? "AND path = '" . serendipity_db_escape_string($fdir) . "'" : '') . "
- AND mime = '" . serendipity_db_escape_string($fdim['mime']) . "'"
+ AND mime = '" . serendipity_db_escape_string($fdim['mime']) . "'
+ AND extension = '" . serendipity_db_escape_string($f[1]) . "'"
);
serendipity_ACL_SQL($cond, false, 'directory');
-
+
$rs = serendipity_db_query("SELECT *
FROM {$serendipity['dbPrefix']}images AS i
{$cond['joins']}
{$cond['and']}", true, 'assoc');
+
if (is_array($rs)) {
// This image is in the database. Check our calculated data against the database data.
$update = array();
@@ -1187,12 +1189,12 @@ function serendipity_syncThumbs($deleteThumbs = false) {
/* Do the database update, if needed */
if (sizeof($update) != 0) {
- printf(FOUND_FILE . '
', $files[$x]);
+ printf(FOUND_FILE . ' (2)
', $files[$x]);
serendipity_updateImageInDatabase($update, $rs['id']);
$i++;
}
} else {
- printf(FOUND_FILE . '
', $files[$x]);
+ printf(FOUND_FILE . ' (1)
', $files[$x]);
serendipity_insertImageInDatabase($fbase . '.' . $f[1], $fdir, 0, filemtime($ffull));
$i++;
}