event photo wasserzeichen umgesetzt. Event admins können eigene einsetzen (als branding) falls das Paket es erlaubt. der Super Admin kann für die günstigen Pakete eigene Wasserzeichen erzwingen
This commit is contained in:
@@ -140,6 +140,29 @@ class PhotoboothIngestService
|
||||
$thumbnailRelative = ImageHelper::makeThumbnailOnDisk($destinationDisk, $destinationPath, $thumbnailPath, 640, 82);
|
||||
$thumbnailToStore = $thumbnailRelative ?? $destinationPath;
|
||||
|
||||
// Create watermarked copies (non-destructive).
|
||||
$watermarkConfig = \App\Support\WatermarkConfigResolver::resolve($event);
|
||||
$watermarkedPath = $destinationPath;
|
||||
$watermarkedThumb = $thumbnailToStore;
|
||||
if ($watermarkConfig['type'] !== 'none' && ! empty($watermarkConfig['asset']) && ! ($watermarkConfig['serve_originals'] ?? false)) {
|
||||
$watermarkedPath = ImageHelper::copyWithWatermark(
|
||||
$destinationDisk,
|
||||
$destinationPath,
|
||||
"events/{$eventSlug}/watermarked/{$filename}",
|
||||
$watermarkConfig
|
||||
) ?? $destinationPath;
|
||||
if ($thumbnailRelative) {
|
||||
$watermarkedThumb = ImageHelper::copyWithWatermark(
|
||||
$destinationDisk,
|
||||
$thumbnailToStore,
|
||||
"events/{$eventSlug}/watermarked/thumbnails/{$filename}",
|
||||
$watermarkConfig
|
||||
) ?? $thumbnailToStore;
|
||||
} else {
|
||||
$watermarkedThumb = $watermarkedPath;
|
||||
}
|
||||
}
|
||||
|
||||
$size = Storage::disk($destinationDisk)->size($destinationPath);
|
||||
$mimeType = Storage::disk($destinationDisk)->mimeType($destinationPath) ?? 'image/jpeg';
|
||||
$originalName = basename($file);
|
||||
@@ -165,8 +188,8 @@ class PhotoboothIngestService
|
||||
'original_name' => $originalName,
|
||||
'mime_type' => $mimeType,
|
||||
'size' => $size,
|
||||
'file_path' => $destinationPath,
|
||||
'thumbnail_path' => $thumbnailToStore,
|
||||
'file_path' => $watermarkedPath,
|
||||
'thumbnail_path' => $watermarkedThumb,
|
||||
'status' => 'pending',
|
||||
'guest_name' => Photo::SOURCE_PHOTOBOOTH,
|
||||
'ingest_source' => Photo::SOURCE_PHOTOBOOTH,
|
||||
@@ -192,6 +215,23 @@ class PhotoboothIngestService
|
||||
'photo_id' => $photo->id,
|
||||
]);
|
||||
|
||||
$watermarkedAsset = null;
|
||||
if ($watermarkedPath !== $destinationPath) {
|
||||
$watermarkedAsset = $this->storageManager->recordAsset($event, $destinationDisk, $watermarkedPath, [
|
||||
'variant' => 'watermarked',
|
||||
'mime_type' => $mimeType,
|
||||
'size_bytes' => Storage::disk($destinationDisk)->exists($watermarkedPath)
|
||||
? Storage::disk($destinationDisk)->size($watermarkedPath)
|
||||
: null,
|
||||
'status' => 'hot',
|
||||
'processed_at' => now(),
|
||||
'photo_id' => $photo->id,
|
||||
'meta' => [
|
||||
'source_variant_id' => $asset->id,
|
||||
],
|
||||
]);
|
||||
}
|
||||
|
||||
if ($thumbnailRelative) {
|
||||
$this->storageManager->recordAsset($event, $destinationDisk, $thumbnailRelative, [
|
||||
'variant' => 'thumbnail',
|
||||
@@ -201,6 +241,21 @@ class PhotoboothIngestService
|
||||
'photo_id' => $photo->id,
|
||||
]);
|
||||
}
|
||||
if ($watermarkedThumb !== $thumbnailToStore) {
|
||||
$this->storageManager->recordAsset($event, $destinationDisk, $watermarkedThumb, [
|
||||
'variant' => 'watermarked_thumbnail',
|
||||
'mime_type' => 'image/jpeg',
|
||||
'status' => 'hot',
|
||||
'processed_at' => now(),
|
||||
'photo_id' => $photo->id,
|
||||
'size_bytes' => Storage::disk($destinationDisk)->exists($watermarkedThumb)
|
||||
? Storage::disk($destinationDisk)->size($watermarkedThumb)
|
||||
: null,
|
||||
'meta' => [
|
||||
'source_variant_id' => $watermarkedAsset?->id ?? $asset->id,
|
||||
],
|
||||
]);
|
||||
}
|
||||
|
||||
$photo->update(['media_asset_id' => $asset->id]);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user