set the inage link in the array to the new path and name
authorEduardo <[email protected]>
Mon, 6 Nov 2023 22:11:48 +0000 (23:11 +0100)
committerEduardo <[email protected]>
Mon, 6 Nov 2023 22:11:48 +0000 (23:11 +0100)
page-generator/index.php

index 16fbf8d2831434f30d1e141f0f8829adce2c9e7a..26a69f4bd55d539f3a086adcb10e9d589cb973c9 100644 (file)
@@ -24,8 +24,12 @@ $image_list = json_decode($image_list, true);
 print_r($image_list);
 
 // copy images from whatever they are (if this is in a docker container they may be mounted somewhere)
-foreach ($image_list as $image) {
-    copy(SRC_PATH . $image['path'], BASE_PATH_TEMP . "/assets/img/" . $image['id'] . '.' . pathinfo($image['path'], PATHINFO_EXTENSION));
+foreach ($image_list as $key => $image) {
+    $old_path = SRC_PATH . $image['path'];
+    $new_path = BASE_PATH_TEMP . "/assets/img/" . $image['id'] . '.' . pathinfo($image['path'], PATHINFO_EXTENSION);
+    copy($old_path, $new_path);
+
+    $image_list[$key]['path'] = "../assets/img/" . $image['id'] . '.' . pathinfo($image['path'], PATHINFO_EXTENSION);
 }
 
 // create partials: