Trouble With Conditional Logic in PHP

I have created an advanced custom field that allows editors to add an image and title to be displayed in a Bootstrap 3 carousel. I am having trouble with the conditional logic for the image field. The script we are using is designed to use the image added in the advanced custom field and if there is no image in the advanced custom field it uses the post’s featured image. The same is true for the title. If a title is entered in the advanced custom field it uses that. If no title is added to the advanced custom field it uses the post title.