Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .github/workflows/cluster-faces-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -140,21 +140,21 @@ jobs:
id: photos-cache
with:
path: data/admin/files/
key: https://cloud.nextcloud.com/s/4JqQdPy3dicQRPr/download/IMDb-Face.zip
key: https://cloud.nextcloud.com/public.php/dav/files/wfDk23DBsXYrd4S/IMDb-Face.zip

- name: Upload photos
if: steps.photos-cache.outputs.cache-hit != 'true'
run: |
mkdir -p data/admin/files/
cd data/admin/files
wget https://cloud.nextcloud.com/s/4JqQdPy3dicQRPr/download/IMDb-Face.zip
wget https://cloud.nextcloud.com/public.php/dav/files/wfDk23DBsXYrd4S/IMDb-Face.zip
unzip IMDb-Face.zip
rm IMDb-Face.zip

- uses: actions/cache/save@v3
with:
path: data/admin/files/
key: https://cloud.nextcloud.com/s/4JqQdPy3dicQRPr/download/IMDb-Face.zip
key: https://cloud.nextcloud.com/public.php/dav/files/wfDk23DBsXYrd4S/IMDb-Face.zip

- name: Set config
run: |
Expand Down Expand Up @@ -259,7 +259,7 @@ jobs:
- name: Download IMDb-Face.csv
working-directory: apps/${{ env.APP_NAME }}/tests/res
run: |
wget https://cloud.nextcloud.com/s/4JqQdPy3dicQRPr/download/IMDb-Face-csv.zip
wget https://cloud.nextcloud.com/public.php/dav/files/wfDk23DBsXYrd4S/IMDb-Face-csv.zip
unzip IMDb-Face-csv.zip
rm IMDb-Face-csv.zip

Expand Down
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"ext-json": "*",
"ext-pdo": "*",
"rubix/ml": "2.x",
"amphp\/parallel": "1.4.x",
"bamarni/composer-bin-plugin": "^1.8"
},
"autoload": {
Expand Down
8 changes: 8 additions & 0 deletions lib/Classifiers/Classifier.php
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,10 @@ public function generatePreviewWithProvider(File $file): string {
// Create a temporary file *with the correct extension*
$tmpname = $this->tempManager->getTemporaryFile('.jpg');

if ($tmpname === false) {
throw new \OCA\Recognize\Exception\Exception('Could not create tmpfile');
}

$tmpfile = fopen($tmpname, 'wb');

if ($tmpfile === false) {
Expand Down Expand Up @@ -385,6 +389,10 @@ public function generatePreviewWithGD(string $path): string {
// Create a temporary file *with the correct extension*
$tmpname = $this->tempManager->getTemporaryFile('.jpg');

if ($tmpname === false) {
throw new \OCA\Recognize\Exception\Exception('Could not create tmpfile');
}

$use_gd_quality = (int)\OCP\Server::get(IConfig::class)->getSystemValue('recognize.preview.quality', '100');
if (imagejpeg($previewImage, $tmpname, $use_gd_quality) === false) {
imagedestroy($image);
Expand Down
Loading