Set tag cover photo automatically on upload.

This commit is contained in:
Aaron van Geffen 2016-09-04 14:55:23 +02:00
parent 2d77fbdbb7
commit e7e3a4368a
3 changed files with 6 additions and 2 deletions

View File

@ -1,5 +1,4 @@
TODO: TODO:
* Taggen door gebruikers * Taggen door gebruikers
* Uploaden door gebruikers
* Album management * Album management

View File

@ -40,6 +40,9 @@ class UploadMedia extends HTMLController
$new_ids[] = $asset->getId(); $new_ids[] = $asset->getId();
$asset->linkTags([$tag->id_tag]); $asset->linkTags([$tag->id_tag]);
$tag->id_asset_thumb = $asset->getId();
$tag->save();
} }
if (isset($_REQUEST['format']) && $_REQUEST['format'] === 'json') if (isset($_REQUEST['format']) && $_REQUEST['format'] === 'json')

View File

@ -10,7 +10,7 @@ class Tag
{ {
public $id_tag; public $id_tag;
public $id_parent; public $id_parent;
public $id_asset_id; public $id_asset_thumb;
public $tag; public $tag;
public $slug; public $slug;
public $description; public $description;
@ -254,6 +254,8 @@ class Tag
return Registry::get('db')->query(' return Registry::get('db')->query('
UPDATE tags UPDATE tags
SET SET
id_parent = {int:id_parent},
id_asset_thumb = {int:id_asset_thumb},
tag = {string:tag}, tag = {string:tag},
count = {int:count} count = {int:count}
WHERE id_tag = {int:id_tag}', WHERE id_tag = {int:id_tag}',