Get images only if parent status is publish

As probably there is not so many unpublished posts with images, You could exclude them from Your WP_Query, adding:

'post_parent' => '-12,-34,-56'

this would add overhead of only one query grabbing id’s of these posts

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)