From 90ec6af8f9b8884201a06d02017575f55c18b310 Mon Sep 17 00:00:00 2001 From: Mauricio Dinarte Date: Sun, 4 Oct 2020 17:51:12 -0600 Subject: [PATCH] Update image paths --- 04.txt | 2 +- 05.txt | 6 +++--- 07.txt | 10 +++++----- 15.txt | 6 +++--- 16.txt | 4 ++-- 17.txt | 4 ++-- 20.txt | 6 +++--- 28.txt | 4 ++-- 8 files changed, 21 insertions(+), 21 deletions(-) diff --git a/04.txt b/04.txt index ff6d936..a9f3459 100644 --- a/04.txt +++ b/04.txt @@ -14,7 +14,7 @@ source: unique_id: 1 name: 'Michele Metts' profile: 'freescholar on Drupal.org' - photo_url: 'https://agaric.coop/sites/default/files/2018-12/micky-cropped.jpg' + photo_url: 'https://udrupal.com/photos/freescholar.jpg' photo_description: 'Photo of Michele Metts' photo_width: '587' photo_height: '657' diff --git a/05.txt b/05.txt index 6ec479f..304006e 100644 --- a/05.txt +++ b/05.txt @@ -91,18 +91,18 @@ Let’s see part of the _source_ definition: ```yaml source: constants: - BASE_URL: "https://agaric.coop" + BASE_URL: "https://udrupal.com" PHOTO_DESCRIPTION_PREFIX: "Photo of" plugin: embedded_data data_rows: - unique_id: 1 name: "Michele Metts" - photo_url: "sites/default/files/2018-12/micky-cropped.jpg" + photo_url: "photos/freescholar.jpg" photo_width: "587" photo_height: "657" ``` -Only one record is presented to keep snippet short, but more exist. In addition to having a unique identifier, each record includes a name, a short profile, and details about the image. Note that this time, the `photo_url` does not provide an absolute URL. Instead, it is a relative path from the domain hosting the images. In this example, the domain is `https://agaric.coop` so that value is stored in the BASE_URL constant which is later used to assemble a valid absolute URL to the image. Also, there is no photo description, but one can be created by concatenating some strings. The PHOTO_DESCRIPTION_PREFIX constant stores the prefix to add to the name to create a photo description. +Only one record is presented to keep snippet short, but more exist. In addition to having a unique identifier, each record includes a name, a short profile, and details about the image. Note that this time, the `photo_url` does not provide an absolute URL. Instead, it is a relative path from the domain hosting the images. In this example, the domain is `https://udrupal.com` so that value is stored in the BASE_URL constant which is later used to assemble a valid absolute URL to the image. Also, there is no photo description, but one can be created by concatenating some strings. The PHOTO_DESCRIPTION_PREFIX constant stores the prefix to add to the name to create a photo description. Now, let’s see the _process_ definition: diff --git a/07.txt b/07.txt index 9799e8a..75f0930 100644 --- a/07.txt +++ b/07.txt @@ -20,18 +20,18 @@ The _source_ of a migration is independent of its _destination_. The following c ```yaml source: constants: - SOURCE_DOMAIN: "https://agaric.coop" + SOURCE_DOMAIN: "https://udrupal.com" DRUPAL_FILE_DIRECTORY: "public://portrait/" plugin: embedded_data data_rows: - photo_id: "P01" - photo_url: "sites/default/files/2018-12/micky-cropped.jpg" + photo_url: "photos/freescholar.jpg" - photo_id: "P02" photo_url: "" - photo_id: "P03" - photo_url: "sites/default/files/pictures/picture-94-1480090110.jpg" + photo_url: "photos/gnuget.jpg" - photo_id: "P04" - photo_url: "sites/default/files/2019-01/clayton-profile-medium.jpeg" + photo_url: "photos/cedewey.jpg" ids: photo_id: type: string @@ -103,7 +103,7 @@ psf_source_image_path: - plugin: urlencode ``` -The end result of this operation will be something like `https://agaric.coop/sites/default/files/2018-12/micky-cropped.jpg`. Note that the `concat` and `url_encode` plugins are used just like in the previous step. A subtle difference is that a `delimiter` is specifying in the concatenation step. This is because, contrary to the `DRUPAL_FILE_DIRECTORY` constant, the `SOURCE_DOMAIN` constant does not end with a _slash_ (**/**). This was done intentionally to highlight two things. First, it is important to understand your source data. Second, you can transform it as needed by using various process plugins. +The end result of this operation will be something like `https://udrupal.com/photos/freescholar.jpg`. Note that the `concat` and `url_encode` plugins are used just like in the previous step. A subtle difference is that a `delimiter` is specifying in the concatenation step. This is because, contrary to the `DRUPAL_FILE_DIRECTORY` constant, the `SOURCE_DOMAIN` constant does not end with a _slash_ (**/**). This was done intentionally to highlight two things. First, it is important to understand your source data. Second, you can transform it as needed by using various process plugins. ## Copying the image file to Drupal diff --git a/15.txt b/15.txt index c299872..2a846bc 100644 --- a/15.txt +++ b/15.txt @@ -98,9 +98,9 @@ The final example will show a slight variation of the previous configuration. Th | | | |-|-|-| -| P01 | https://agaric.coop/sites/default/files/pictures/picture-15-1421176712.jpg | -| P02 | https://agaric.coop/sites/default/files/pictures/picture-3-1421176784.jpg | -| P03 | https://agaric.coop/sites/default/files/pictures/picture-2-1421176752.jpg | +| P01 | https://udrupal.com/photos/freescholar.jpg | +| P02 | https://udrupal.com/photos/mlncn.jpg | +| P03 | https://udrupal.com/photos/sfreudenberg.jpg | ```yaml diff --git a/16.txt b/16.txt index 6da9b21..fef0ed9 100644 --- a/16.txt +++ b/16.txt @@ -41,7 +41,7 @@ This migration will reuse the same configuration from the [introduction to parag "udm_photos": [ { "photo_id": "P01", - "photo_url": "https://agaric.coop/sites/default/files/pictures/picture-15-1421176712.jpg", + "photo_url": "https://udrupal.com/photos/freescholar.jpg", "photo_dimensions": [240, 351] }, {...}, @@ -207,7 +207,7 @@ Let's consider an example where the records to migrate have *more data than need "udm_photos": [ { "photo_id": "P01", - "photo_url": "https://agaric.coop/sites/default/files/pictures/picture-15-1421176712.jpg", + "photo_url": "https://udrupal.com/photos/freescholar.jpg", "photo_dimensions": [240, 351] }, {...}, diff --git a/17.txt b/17.txt index 56a7f86..fee65d0 100644 --- a/17.txt +++ b/17.txt @@ -44,7 +44,7 @@ This migration will reuse the same configuration from the [introduction to parag P01 - https://agaric.coop/sites/default/files/pictures/picture-15-1421176712.jpg + https://udrupal.com/photos/freescholar.jpg 240 351 @@ -229,7 +229,7 @@ Let's consider an example where the elements to migrate have *more data than nee P01 - https://agaric.coop/sites/default/files/pictures/picture-15-1421176712.jpg + https://udrupal.com/photos/freescholar.jpg 240 351 diff --git a/20.txt b/20.txt index b7fb2ec..4fb0406 100644 --- a/20.txt +++ b/20.txt @@ -78,9 +78,9 @@ destination: Now let's consider an example of a spreadsheet file that does not have a header row. This example is for the *image* migration and uses a Microsoft Excel file. The following snippets shows the `UD Example Sheet` worksheet and the configuration of the *source* plugin: ``` -P01, https://agaric.coop/sites/default/files/pictures/picture-15-1421176712.jpg -P02, https://agaric.coop/sites/default/files/pictures/picture-3-1421176784.jpg -P03, https://agaric.coop/sites/default/files/pictures/picture-2-1421176752.jpg +P01, https://udrupal.com/photos/freescholar.jpg +P02, https://udrupal.com/photos/mlncn.jpg +P03, https://udrupal.com/photos/sfreudenberg.jpg ``` ```yaml diff --git a/28.txt b/28.txt index ed30ab4..5ab2122 100644 --- a/28.txt +++ b/28.txt @@ -42,7 +42,7 @@ $ drush migrate:import udm_csv_source_image --migrate-debug --limit=1 └──────────────────────────────────────────────────────────────────────────────┘ array (10) [ 'photo_id' => string (3) "P01" - 'photo_url' => string (74) "https://agaric.coop/sites/default/files/pictures/picture-15-1421176712.jpg" + 'photo_url' => string (74) "https://udrupal.com/photos/freescholar.jpg" 'path' => string (76) "modules/custom/ud_migrations/ud_migrations_csv_source/sources/udm_photos.csv" 'ids' => array (1) [ string (8) "photo_id" @@ -69,7 +69,7 @@ array (10) [ array (4) [ 'psf_destination_filename' => string (25) "picture-15-1421176712.jpg" 'psf_destination_full_path' => string (25) "picture-15-1421176712.jpg" - 'psf_source_image_path' => string (74) "https://agaric.coop/sites/default/files/pictures/picture-15-1421176712.jpg" + 'psf_source_image_path' => string (74) "https://udrupal.com/photos/freescholar.jpg" 'uri' => string (29) "./picture-15-1421176712_6.jpg" ] ┌──────────────────────────────────────────────────────────────────────────────┐