Thanks all for the output formatting, makes a lot of sense, and will now include in updates to page. I actually was using it when creating the page, just not when saving again.
I tested the following code and there was no difference:
$p->of(false);
$p->singleImage->add($remoteUrl); //grab the image.
$p->save();
$image = $p->singleImage->first(); //load up image that was just saved.
$newFilename = $parentName . '-' . $childName . '.' . strtolower($image->ext());
$p->of(false);
$p->singleImage->rename($image, $newFilename);
$p->save(); //save changes to page.
File name was not changed, in either the file system or on the page's record.
Then I changed the target of the renaming from the field, to the actual file, this did rename in the file system, but did not update the image field in the db:
$p->of(false);
$p->singleImage->add($remoteUrl); //grab the image.
$p->save();
$image = $p->singleImage->first(); //load up image that was just saved.
$newFilename = $parentName . '-' . $childName . '.' . strtolower($image->ext());
$p->of(false);
//$p->singleImage->rename($image, $newFilename);
$image->rename($newFilename);
$p->save(); //save changes to page.
When I use the `$p->singleImage->rename($image, $newFilename);` method it seems to expect the image object not just the file name, which is not what the docs say. Any ideas on this?