Add images to tasks

Everyone who may comment on a task sends images to it, e.g. photos
taken with a phone. The server stores an upright, at most 2560 px JPEG
without EXIF data (no location) and a 400 px thumbnail on the private
disk, served only to those who see the job. Uploaders change captions
(also the alt text) and remove their own images; admin and management
may remove anyone's (jobs.remove-any-task-image). Removing a task also
removes its image files.

Livewire's temporary upload limit is raised to PHP's 40 MB so that the
page's own 12 MB limit gives a translated message.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
This commit is contained in:
2026-11-25 07:46:53 +02:00
co-authored by Claude Sonnet 5.5
parent 4fb8ea1c5f
commit ae8172898d
40 changed files with 2250 additions and 8 deletions
@@ -0,0 +1,39 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Images sent to tasks. The files (a downscaled JPEG and its thumbnail)
* are on the private local disk; the uploader is kept as null if the
* user is ever deleted.
*/
public function up(): void
{
Schema::create('task_images', function (Blueprint $table) {
$table->id();
$table->foreignId('task_id')->constrained()->cascadeOnDelete();
$table->foreignId('user_id')->nullable()->constrained()->nullOnDelete();
$table->string('path');
$table->string('thumbnail_path');
$table->string('original_name');
$table->string('caption')->nullable();
$table->unsignedInteger('width');
$table->unsignedInteger('height');
$table->timestamps();
$table->index(['task_id', 'id']);
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('task_images');
}
};