Index: conf.c =================================================================== --- conf.c (revision 223) +++ conf.c (working copy) @@ -108,6 +108,7 @@ sql_log_snapshot: 1, sql_log_mpeg: 0, sql_log_timelapse: 0, + sql_log_preview: 0, sql_query: DEF_SQL_QUERY, mysql_db: NULL, mysql_host: "localhost", @@ -496,6 +497,7 @@ "############################################################\n\n" "# Output 'normal' pictures when motion is detected (default: on)\n" "# Valid values: on, off, first, best, center\n" + "# on_and_first, on_and_best, on_and_center\n" "# When set to 'first', only the first picture of an event is saved.\n" "# Picture with most motion of an event is saved when set to 'best'.\n" "# Picture with motion nearest center of picture is saved when set to 'center'.\n" @@ -1049,6 +1051,14 @@ print_bool }, { + "sql_log_preview", + "# Log to the database when creating preview image file\n" + "# Valid values: on, off (default: off)", + CONF_OFFSET(sql_log_preview), + copy_bool, + print_bool + }, + { "sql_query", "# SQL query string that is sent to the database\n" "# Use same conversion specifiers has for text features\n" Index: conf.h =================================================================== --- conf.h (revision 223) +++ conf.h (working copy) @@ -92,6 +92,7 @@ int sql_log_snapshot; int sql_log_mpeg; int sql_log_timelapse; + int sql_log_preview; const char *sql_query; const char *mysql_db; const char *mysql_host; Index: motion.c =================================================================== --- motion.c (revision 223) +++ motion.c (working copy) @@ -761,6 +761,8 @@ cnt->conf.sql_log_snapshot * FTYPE_IMAGE_SNAPSHOT + cnt->conf.sql_log_mpeg * (FTYPE_MPEG + FTYPE_MPEG_MOTION) + cnt->conf.sql_log_timelapse * FTYPE_MPEG_TIMELAPSE; + if (cnt->conf.sql_log_preview) + cnt->sql_mask |= FTYPE_IMAGE_PREVIEW; #endif /* defined(HAVE_MYSQL) || defined(HAVE_PGSQL) */ /* Load the mask file if any */ @@ -1596,6 +1598,12 @@ cnt->new_img = NEWIMG_BEST; else if (strcasecmp(cnt->conf.output_normal, "center") == 0) cnt->new_img = NEWIMG_CENTER; + else if (strcasecmp(cnt->conf.output_normal, "on_and_first") == 0) + cnt->new_img = NEWIMG_FIRST | NEWIMG_ON; + else if (strcasecmp(cnt->conf.output_normal, "on_and_best") == 0) + cnt->new_img = NEWIMG_BEST | NEWIMG_ON; + else if (strcasecmp(cnt->conf.output_normal, "on_and_center") == 0) + cnt->new_img = NEWIMG_CENTER | NEWIMG_ON; else cnt->new_img = NEWIMG_OFF; @@ -1631,6 +1639,10 @@ cnt->conf.sql_log_snapshot * FTYPE_IMAGE_SNAPSHOT + cnt->conf.sql_log_mpeg * (FTYPE_MPEG + FTYPE_MPEG_MOTION) + cnt->conf.sql_log_timelapse * FTYPE_MPEG_TIMELAPSE; + + if (cnt->conf.sql_log_preview) + cnt->sql_mask |= FTYPE_IMAGE_PREVIEW; + #endif /* defined(HAVE_MYSQL) || defined(HAVE_PGSQL) */ } Index: motion.h =================================================================== --- motion.h (revision 223) +++ motion.h (working copy) @@ -154,9 +154,10 @@ #define FTYPE_MPEG 8 #define FTYPE_MPEG_MOTION 16 #define FTYPE_MPEG_TIMELAPSE 32 +#define FTYPE_IMAGE_PREVIEW 64 #define FTYPE_MPEG_ANY (FTYPE_MPEG | FTYPE_MPEG_MOTION | FTYPE_MPEG_TIMELAPSE) -#define FTYPE_IMAGE_ANY (FTYPE_IMAGE | FTYPE_IMAGE_SNAPSHOT | FTYPE_IMAGE_MOTION) +#define FTYPE_IMAGE_ANY (FTYPE_IMAGE | FTYPE_IMAGE_SNAPSHOT | FTYPE_IMAGE_MOTION | FTYPE_IMAGE_PREVIEW) /* What types of jpeg files do we want to have */ #define NEWIMG_OFF 0 Index: picture.c =================================================================== --- picture.c (revision 223) +++ picture.c (working copy) @@ -665,7 +665,7 @@ strncpy(previewname, cnt->newfilename, basename_len); previewname[basename_len] = '\0'; strcat(previewname, imageext(cnt)); - put_picture(cnt, previewname, cnt->imgs.preview_image.image , FTYPE_IMAGE); + put_picture(cnt, previewname, cnt->imgs.preview_image.image , FTYPE_IMAGE_PREVIEW); } else #endif /* HAVE_FFMPEG */ { @@ -683,7 +683,7 @@ mystrftime(cnt, filename, sizeof(filename), jpegpath, &cnt->imgs.preview_image.timestamp_tm, NULL, 0); snprintf(previewname, PATH_MAX, "%s/%s.%s", cnt->conf.filepath, filename, imageext(cnt)); - put_picture(cnt, previewname, cnt->imgs.preview_image.image, FTYPE_IMAGE); + put_picture(cnt, previewname, cnt->imgs.preview_image.image, FTYPE_IMAGE_PREVIEW); } /* restore global context values */