Add Featured Image from Existing wp-content folder

While looking at some code for another issue I had a lightbulb went off in my head and brought me back to this problem. So after several tries at it I came up with this…

    function add_image_to_feed( $thumbz){
if( is_feed() ){
    $def_thmb = get_post_meta( get_the_ID(),'def_thmb',true);

    $subPath = tube_sub_dir_path(get_the_ID()); 

    $upload_dir = wp_upload_dir();
    $thumb_ur = $upload_dir[baseurl]."/tube-thumbs/".$subPath."";

    $thumbz = $thumb_ur."https://wordpress.stackexchange.com/".get_the_ID()."_".$def_thmb.".jpg";

} else {
    return;
}
$thumbz = "<img class=\"img-responsive\" src=\"$thumbz\" >";
return $thumbz;

}

So now these images are being added directly to my feed which works brilliantly for me. I simply use an RSS plugin to add these thumbs as a featured image. The entire process is now automated I don’t need to touch a thing now that it is set.

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