Zend certified PHP/Magento developer

Set programmatically image roles

I have that in my backoffice :
witout

and I need that:
with

This solution does not work for me :

  if($key == 1){
        $prod->addImageToMediaGallery($imgPath, array('image', 'small_image','thumbnail'), false, false);
    }else{
        $prod->addImageToMediaGallery($imgPath, null, false, false);
    }
    $prod->save();

How can I do ?

Thank you