Can’t put a hyperlink on Featured Post’s Image

After spending 8 hours banging my head I had to do some investigating into the internet.
Figured out some stuff and got it to work. Apparently I’m the only one who’s had this issue so I’m going to post my answer to help fellow Web Programmers.

So above you will see my original code, I am using the WP Favorite Posts to get the posts that the user favorites but it doesn’t come with image support so I add images and then the linking issue occurred. My solution was the following code below but despite it being this code, I couldn’t find any info about this on the codex.

Anywho here’s the code part I changed I hope it helps!
Simply look on top an see what I changed/added.

echo "<div>";
while ( have_posts() ) : the_post();
echo "<div><a href="".get_permalink()."" title="". get_the_title() ."">" . 
get_the_title() . "</a> " ;
wpfp_remove_favorite_link(get_the_ID());
echo '<a href="' . get_permalink($post->ID) . '" >';
the_post_thumbnail('medium');
echo '</a>';
echo "</div>";
endwhile;
echo "</div>";