Strip photo metadata with GD (Imagick keeps EXIF), --force option, stricter test

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Lars StommerandClaude Opus 5.5 committed 2026-10-22 21:43:54 +02:00
1 parent 4f69b426a4
commit 6690beafe6
4 files changed
+16 -7

No files matched your search

+8 -1
View File
@@ -115,9 +115,16 @@ public function test_uploaded_photo_originals_are_stripped_of_metadata(): void
Storage::fake('public');
$photo = Photo::factory()->create();
$media = $photo->addMedia(UploadedFile::fake()->image('drohne.jpg', 1200, 800))->toMediaCollection(Photo::COLLECTION);
$image = UploadedFile::fake()->image('drohne.jpg', 1200, 800);
$jpeg = (string) file_get_contents($image->getPathname());
$exif = 'Exif'."\0\0".'GPS-Position 54.15N 11.75E';
file_put_contents($image->getPathname(), substr($jpeg, 0, 2)."\xFF\xE1".pack('n', strlen($exif) + 2).$exif.substr($jpeg, 2));
$this->assertStringContainsString('GPS-Position', (string) file_get_contents($image->getPathname()));
$media = $photo->addMedia($image)->toMediaCollection(Photo::COLLECTION);
$this->assertTrue($media->fresh()->getCustomProperty('metadata_stripped'));
$this->assertStringNotContainsString('GPS-Position', (string) file_get_contents($media->getPath()));
$this->artisan('photos:strip-metadata')->expectsOutputToContain('0 Original-Foto(s) bereinigt.')->assertSuccessful();
}