Search the Community
Showing results for tags 'site migration'.
I've just started working on a custom script that will allow me to migrate images from my client's old site to my new PW site. (The pages the images are going to be added to already exist on the new PW site.) I am able to successfully add images using $page->images->add, but when I edit the page I've added the image to in admin, the image doesn't show up in my images field. I'm relatively new to the API and assume I must be missing some basic piece here, maybe something have to do with Pageimage or OutputFormatting? Any help is very much appreciated! Here is the very preliminary code I'm using to test this out: //these variables will eventually be arrays I'll iterate over... $page_id = 'page id'; $description = 'image description'; $image_path = 'image url from old site'; //add image and image description $page = wire("pages")->get($page_id); $page->images->add('$image_path'); $page->images->last()->description = $description;