I add an image to product's image gallery with this code:
// $filePath: image full path
$mediaArray = array(
"thumbnail" => $filePath,
"small_image" => $filePath,
"image" => $filePath,
);
$product->addImageToMediaGallery($filePath, $mediaArray, true, false);
$product->save();
After this code, the image will be added to gallery but it is unselected. How can I select this image as "base image" (and/or Small Image, Thumbnail)?