Pass DIY slug when uploading photos.
This commit is contained in:
parent
068d1dad3e
commit
c6c249787f
@ -33,10 +33,14 @@ class UploadMedia extends HTMLController
|
|||||||
if (empty($uploaded_file))
|
if (empty($uploaded_file))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
// DIY slug club.
|
||||||
|
$slug = $tag->slug . '/' . strtr($uploaded_file['name'], [' ' => '-', '--' => '-', '&' => 'and', '=>' => '', "'" => "", ":"=> "", '\\' => '-']);
|
||||||
|
|
||||||
$asset = Asset::createNew([
|
$asset = Asset::createNew([
|
||||||
'filename_to_copy' => $uploaded_file['tmp_name'],
|
'filename_to_copy' => $uploaded_file['tmp_name'],
|
||||||
'preferred_filename' => $uploaded_file['name'],
|
'preferred_filename' => $uploaded_file['name'],
|
||||||
'preferred_subdir' => $tag->slug,
|
'preferred_subdir' => $tag->slug,
|
||||||
|
'slug' => $slug,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$new_ids[] = $asset->getId();
|
$new_ids[] = $asset->getId();
|
||||||
|
Loading…
Reference in New Issue
Block a user