If $size
is already an array in your original code as it looks to be, then the argument passed will become array(array(150,150))
instead of just array(150,150)
and fail, so you can just do:
<?php $title=get_the_title(); the_post_thumbnail( $size, array( 'alt' =>$title) ); ?>