Add minWidth to source image

This commit is contained in:
philipp lang 2020-10-27 02:22:40 +01:00
parent bffa99b042
commit 23c1531895
4 changed files with 5 additions and 4 deletions

View File

@ -22,7 +22,8 @@ class UploadStorage {
'basename' => pathinfo($this->file->getClientOriginalName(), PATHINFO_FILENAME), 'basename' => pathinfo($this->file->getClientOriginalName(), PATHINFO_FILENAME),
'extension' => $this->file->getClientOriginalExtension(), 'extension' => $this->file->getClientOriginalExtension(),
'tags' => [], 'tags' => [],
'aspect_ratio' => $this->data['resAspectRatio'] 'aspect_ratio' => $this->data['aspectRatio'],
'min_width' => $this->data['minWidth']
]); ]);
$sourceFile->slugAttributes(); $sourceFile->slugAttributes();

View File

@ -174,9 +174,8 @@ export default {
onSend(file, xhr, formData) { onSend(file, xhr, formData) {
formData.append('extraData', JSON.stringify({ formData.append('extraData', JSON.stringify({
...this.extraData[file.name], ...this.extraData[file.name],
resAspectRatio: this.cropOptions.aspectRatio ...this.cropOptions
})); }));
formData.append('resAspectRatio', this.aspectRatio);
this.formData.forEach((v) => { this.formData.forEach((v) => {
formData.append(v.name, v.value); formData.append(v.name, v.value);
}); });

View File

@ -24,7 +24,7 @@ class SourceFile extends Model
/** /**
* @var array Fillable fields * @var array Fillable fields
*/ */
protected $fillable = ['id', 'basename', 'extension', 'tags', 'slug', 'aspect_ratio']; protected $fillable = ['id', 'basename', 'extension', 'tags', 'slug', 'aspect_ratio', 'min_width'];
public $jsonable = ['tags', 'aspect_ratio']; public $jsonable = ['tags', 'aspect_ratio'];

View File

@ -16,6 +16,7 @@ class CreateResponsiveFilesTable extends Migration
$table->string('extension'); $table->string('extension');
$table->json('tags'); $table->json('tags');
$table->string('aspect_ratio')->nullable(); $table->string('aspect_ratio')->nullable();
$table->integer('min_width')->nullable();
$table->timestamps(); $table->timestamps();
}); });