Skip to content

Commit

Permalink
Improve meta data of imported files (#24)
Browse files Browse the repository at this point in the history
* Set ``alternative`` to the ``description`` if available.

* Set ``creator_tool`` to the "destination.one".

* Set ``source`` to the URL of the fetched image.
  • Loading branch information
DanielSiepmann authored Jun 19, 2023
1 parent bae6800 commit c56a10b
Show file tree
Hide file tree
Showing 12 changed files with 51 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,9 @@ private function updateMetadata(
$this->metaDataRepository->update($file->getUid(), [
'title' => $this->getShortenedString($mediaObject['value'], 100),
'description' => $mediaObject['description'] ?? '',
'alternative' => 'DD Import',
'alternative' => $mediaObject['description'] ?? '',
'creator_tool' => 'destination.one',
'source' => $mediaObject['url'] ?? '',
]);
}

Expand Down
8 changes: 8 additions & 0 deletions Documentation/Changelog/3.4.0.rst
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,14 @@ Features
That ensures that modifications during import or while editing records are flushing
corresponding pages.

* Improve handling of file meta data during import from destination.one.

* Set ``alternative`` to the ``description`` if available.

* Set ``creator_tool`` to the "destination.one".

* Set ``source`` to the URL of the fetched image.

Fixes
-----

Expand Down
4 changes: 4 additions & 0 deletions Tests/Functional/Import/DestinationDataTest/AbstractTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ abstract class AbstractTest extends AbstractFunctionalTestCase
{
protected function setUp(): void
{
$this->coreExtensionsToLoad = [
'filemetadata',
];

parent::setUp();

$this->importPHPDataSet(__DIR__ . '/Fixtures/Database/Structure.php');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
,3,1,"tx_events_domain_model_event","categories",,,,,,,,,,,,,,,,,
"sys_file_metadata",,,,,,,,,,,,,,,,,,,,,
,"uid","pid","title","description","alternative",,,,,,,,,,,,,,,,
,1,0,"This title is longer then the supported 255 chars as limited by default by TYPO3 database. Also c …","This is a supported description","DD Import",,,,,,,,,,,,,,,,
,1,0,"This title is longer then the supported 255 chars as limited by default by TYPO3 database. Also c …","This is a supported description","This is a supported description",,,,,,,,,,,,,,,,
"sys_file_reference",,,,,,,,,,,,,,,,,,,,,
,"uid","uid_local","uid_foreign","tablenames","fieldname","title","description",,,,,,,,,,,,,,
,1,1,1,"tx_events_domain_model_event","images",,,,,,,,,,,,,,,,
Original file line number Diff line number Diff line change
Expand Up @@ -58,15 +58,19 @@
'file' => 1,
'title' => 'Theater-Rudolstadt_Johannes-Geißer_photo-by-Lisa-Stern_web_.jpg',
'description' => '',
'alternative' => 'DD Import',
'alternative' => '',
'creator_tool' => 'destination.one',
'source' => 'https://dam.destination.one/849917/279ac45b3fc701a7197131f627164fffd9f8cc77bc75165e2fc2b864ed606920/theater-rudolstadt_johannes-gei-er_photo-by-lisa-stern_web_-jpg.jpg',
],
[
'uid' => 2,
'pid' => 0,
'file' => 2,
'title' => 'Tueftlerzeit©SFZ-Rudolstadt.jpg',
'description' => 'Description of Tueftlerzeit',
'alternative' => 'DD Import',
'alternative' => 'Description of Tueftlerzeit',
'creator_tool' => 'destination.one',
'source' => 'https://dam.destination.one/828118/f13bbf5602ffc406ebae2faa3527654dea84194666bce4925a1ca8bd3f50c5e9/tueftlerzeit-sfz-rudolstadt-jpg.jpg',
],
],
];
Original file line number Diff line number Diff line change
Expand Up @@ -90,23 +90,29 @@
'file' => 1,
'title' => 'Theater-Rudolstadt_Johannes-Geißer_photo-by-Lisa-Stern_web_.jpg',
'description' => '',
'alternative' => 'DD Import',
'alternative' => '',
'creator_tool' => 'destination.one',
'source' => 'https://dam.destination.one/849917/279ac45b3fc701a7197131f627164fffd9f8cc77bc75165e2fc2b864ed606920/theater-rudolstadt_johannes-gei-er_photo-by-lisa-stern_web_-jpg.jpg',
],
[
'uid' => 2,
'pid' => 0,
'file' => 2,
'title' => 'Tueftlerzeit©SFZ-Rudolstadt.jpg',
'description' => 'Description of Tueftlerzeit',
'alternative' => 'DD Import',
'alternative' => 'Description of Tueftlerzeit',
'creator_tool' => 'destination.one',
'source' => 'https://dam.destination.one/828118/f13bbf5602ffc406ebae2faa3527654dea84194666bce4925a1ca8bd3f50c5e9/tueftlerzeit-sfz-rudolstadt-jpg.jpg',
],
[
'uid' => 3,
'pid' => 0,
'file' => 3,
'title' => 'Lutherkirche.jpg',
'description' => '',
'alternative' => 'DD Import',
'alternative' => '',
'creator_tool' => 'destination.one',
'source' => 'https://dam.destination.one/853436/109ac1cf87913e21b5e2b0ef0cc63d223a14374364952a855746a8e7c3fcfc36/lutherkirche-jpg.jpg',
],
],
];
Original file line number Diff line number Diff line change
Expand Up @@ -81,23 +81,29 @@
'file' => 1,
'title' => 'Theater-Rudolstadt_Johannes-Geißer_photo-by-Lisa-Stern_web_.jpg',
'description' => '',
'alternative' => 'DD Import',
'alternative' => '',
'creator_tool' => 'destination.one',
'source' => 'https://dam.destination.one/849917/279ac45b3fc701a7197131f627164fffd9f8cc77bc75165e2fc2b864ed606920/theater-rudolstadt_johannes-gei-er_photo-by-lisa-stern_web_-jpg.jpg',
],
[
'uid' => 2,
'pid' => 0,
'file' => 2,
'title' => 'Tueftlerzeit©SFZ-Rudolstadt.jpg',
'description' => 'Description of Tueftlerzeit',
'alternative' => 'DD Import',
'alternative' => 'Description of Tueftlerzeit',
'creator_tool' => 'destination.one',
'source' => 'https://dam.destination.one/828118/f13bbf5602ffc406ebae2faa3527654dea84194666bce4925a1ca8bd3f50c5e9/tueftlerzeit-sfz-rudolstadt-jpg.jpg',
],
[
'uid' => 3,
'pid' => 0,
'file' => 3,
'title' => 'Lutherkirche.jpg',
'description' => '',
'alternative' => 'DD Import',
'alternative' => '',
'creator_tool' => 'destination.one',
'source' => 'https://dam.destination.one/853436/109ac1cf87913e21b5e2b0ef0cc63d223a14374364952a855746a8e7c3fcfc36/lutherkirche-jpg.jpg',
],
],
];
Original file line number Diff line number Diff line change
Expand Up @@ -57,16 +57,12 @@
'pid' => 0,
'file' => 1,
'title' => 'Theater-Rudolstadt_Johannes-Geißer_photo-by-Lisa-Stern_web_.jpg',
'description' => '',
'alternative' => 'DD Import',
],
[
'uid' => 2,
'pid' => 0,
'file' => 2,
'title' => 'Tueftlerzeit©SFZ-Rudolstadt.jpg',
'description' => 'Description of Tueftlerzeit',
'alternative' => 'DD Import',
],
],
'tx_events_domain_model_event' => [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,15 +58,19 @@
'file' => 1,
'title' => 'Theater-Rudolstadt_Johannes-Geißer_photo-by-Lisa-Stern_web_.jpg',
'description' => '',
'alternative' => 'DD Import',
'alternative' => '',
'creator_tool' => 'destination.one',
'source' => 'https://dam.destination.one/849917/279ac45b3fc701a7197131f627164fffd9f8cc77bc75165e2fc2b864ed606920/theater-rudolstadt_johannes-gei-er_photo-by-lisa-stern_web_-jpg.jpg',
],
[
'uid' => 2,
'pid' => 0,
'file' => 2,
'title' => 'Tueftlerzeit©SFZ-Rudolstadt.jpg',
'description' => 'Description of Tueftlerzeit',
'alternative' => 'DD Import',
'alternative' => 'Description of Tueftlerzeit',
'creator_tool' => 'destination.one',
'source' => 'https://dam.destination.one/828118/f13bbf5602ffc406ebae2faa3527654dea84194666bce4925a1ca8bd3f50c5e9/tueftlerzeit-sfz-rudolstadt-jpg.jpg',
],
],
];
Original file line number Diff line number Diff line change
Expand Up @@ -57,16 +57,12 @@
'pid' => 0,
'file' => 1,
'title' => 'Theater-Rudolstadt_Johannes-Geißer_photo-by-Lisa-Stern_web_.jpg',
'description' => '',
'alternative' => 'DD Import',
],
[
'uid' => 2,
'pid' => 0,
'file' => 2,
'title' => 'Tueftlerzeit©SFZ-Rudolstadt.jpg',
'description' => 'Description of Tueftlerzeit',
'alternative' => 'DD Import',
],
],
];
Original file line number Diff line number Diff line change
Expand Up @@ -64,15 +64,15 @@
'file' => 1,
'title' => 'Theater-Rudolstadt_Johannes-Geißer_photo-by-Lisa-Stern_web_.jpg',
'description' => '',
'alternative' => 'DD Import',
'alternative' => '',
],
[
'uid' => 2,
'pid' => 0,
'file' => 2,
'title' => 'Tueftlerzeit©SFZ-Rudolstadt.jpg',
'description' => 'Description of Tueftlerzeit',
'alternative' => 'DD Import',
'alternative' => 'Description of Tueftlerzeit',
],
],
'tx_events_domain_model_event' => [
Expand Down
5 changes: 3 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,10 @@
"php": "~7.2.0 || ~7.3.0 || ~7.4.0 || ~8.0.0 || ~8.1.0 || ~8.2.0",
"typo3/cms-core": "^10.4 || ^11.5",
"typo3/cms-extbase": "^10.4 || ^11.5",
"typo3/cms-filelist": "^10.4 || ^11.5",
"typo3/cms-filemetadata": "^10.4 || ^11.5",
"typo3/cms-fluid": "^10.4 || ^11.5",
"typo3/cms-frontend": "^10.4 || ^11.5",
"typo3/cms-filelist": "^10.4 || ^11.5"
"typo3/cms-frontend": "^10.4 || ^11.5"
},
"autoload": {
"psr-4": {
Expand Down

0 comments on commit c56a10b

Please sign in to comment.