Skip to content

Commit

Permalink
api: remove code for numbered images
Browse files Browse the repository at this point in the history
Without a real database it's complicated to get a real number.
If an image is deleted, other images might get overridden because
the next number might exist already.

Change-Id: I96c93ef2795e6d82cc3f06c477c7e2f763d8e610
  • Loading branch information
andi34 committed Nov 22, 2022
1 parent 3430c73 commit 224c9e7
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 19 deletions.
11 changes: 1 addition & 10 deletions api/chromakeying/save.php
Expand Up @@ -5,16 +5,7 @@
require_once '../../lib/db.php';
require_once '../../lib/resize.php';

if ($config['picture']['naming'] === 'numbered') {
if ($config['database']['enabled']) {
$images = getImagesFromDB();
} else {
$images = getImagesFromDirectory($config['foldersAbs']['images']);
}
$img_number = count($images);
$files = str_pad(++$img_number, 4, '0', STR_PAD_LEFT);
$name = $files . '.jpg';
} elseif ($config['picture']['naming'] === 'dateformatted') {
if ($config['picture']['naming'] === 'dateformatted') {
$name = date('Ymd_His') . '.jpg';
} else {
$name = md5(microtime()) . '.jpg';
Expand Down
9 changes: 0 additions & 9 deletions api/takePic.php
Expand Up @@ -75,15 +75,6 @@ function takePicture($filename) {

if (!empty($_POST['file']) && preg_match('/^[a-z0-9_]+\.jpg$/', $_POST['file'])) {
$name = $_POST['file'];
} elseif ($config['picture']['naming'] === 'numbered') {
if ($config['database']['enabled']) {
$images = getImagesFromDB();
} else {
$images = getImagesFromDirectory($config['foldersAbs']['images']);
}
$img_number = count($images);
$files = str_pad(++$img_number, 4, '0', STR_PAD_LEFT);
$name = $files . '.jpg';
} elseif ($config['picture']['naming'] === 'dateformatted') {
$name = date('Ymd_His') . '.jpg';
} else {
Expand Down

0 comments on commit 224c9e7

Please sign in to comment.