From: Eduardo Date: Mon, 6 Nov 2023 22:11:48 +0000 (+0100) Subject: set the inage link in the array to the new path and name X-Git-Url: http://git.edufdez.es/?a=commitdiff_plain;h=fc910dc3f7c89cda9a1b214d0b7fe160f73714d9;p=thericegoat.com.git set the inage link in the array to the new path and name --- diff --git a/page-generator/index.php b/page-generator/index.php index 16fbf8d..26a69f4 100644 --- a/page-generator/index.php +++ b/page-generator/index.php @@ -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: