[Tex/LaTex] How to add a profile picture to Deedy-Resume CV

cvdiagrams

Newbie TEX user, having trouble adding a profile picture to my CV (based on Deedy-Resume template)

\begin{document}

%----------------------------------------------------------------------------------------
%TITLE SECTION
%----------------------------------------------------------------------------------------

\smash{\includegraphics[width=3cm]{snow_circle.png}}  % <<<- I added this for picture 
\namesection{Debarghya}{Das}{ % Your name
\urlstyle{same}\url{http://debarghyadas.com} \\ % Your website, LinkedIn profile or other web address
\href{mailto:dd367@cornell.edu}{dd367@cornell.edu} | 607.379.5733 % Your contact information
}

But, this results in half the picture showing up at the top left corner.
enter image description here
Could anybody help me make it look something like,
enter image description here

Will be even more thankful if you could also tell me how to split the name field into two lines. My name is rather long and I would like it to rather be in two lines instead of one. So that it looks like below :

PICTURE              ARAVINDH
                     SAMPATHKUMAR
                    other details

Here is the code for /namesection in the .cls file,

\newcommand{\namesection}[3]{ % Defines the command for the main heading
\centering{ % Center the name
\fontsize{40pt}{60pt} % Font size
\fontspec[Path = fonts/lato/]{Lato-Hai}\selectfont #1 % First name font
\fontspec[Path = fonts/lato/]{Lato-Lig}\selectfont #2 % Last name font
} \\[5pt] % Whitespace between the name and contact information
\centering{ % Center the contact information
\color{headings} % Use the headings color
\fontspec[Path = fonts/raleway/]{Raleway-Medium}\fontsize{11pt}    {14pt}\selectfont #3} % Contact information font
\noindent\makebox[\linewidth]{\color{headings}\rule{\paperwidth}{0.4pt}} % Horizontal rule
\vspace{-5pt} % Reduce whitespace after the rule slightly
}

Best Answer

Here is a code to obtain what you want, partly with trial and errors:

Add this to your preamble. The \namesection command is redefined with one optional argument (the options for `includegraphics) and 4 mandatory argyments (the first argument being the name of the graphic file):

\usepackage{graphicx} 
\usepackage{tabularx} 
\renewcommand\tabularxcolumn[1]{ >{\centering\arraybackslash}m{#1}}

\renewcommand{\namesection}[5][]{% Defines the command for the main heading
\begin{tabularx}{\linewidth}{cX} % Center the name
\raisebox{-0.7\height}[0pt][0pt]{\includegraphics[#1]{#2}} & \fontsize{40pt}{60pt} % Font size
\fontspec[Path = fonts/lato/]{Lato-Lig}\selectfont #3 % First name font
\fontspec[Path = fonts/lato/]{Lato-Hai}\selectfont #4 % Last name font
 \\[5pt] % Whitespace between the name and contact information
 &\parbox{\linewidth}{\color{headings}% Use the headings color
\fontspec[Path = fonts/raleway/]{Raleway-Medium}\fontsize{11pt}{14pt}\selectfont\centering #5}\smallskip
\end{tabularx}\\ % Contact information font
\noindent\makebox[\linewidth]{\color{headings}\rule{\paperwidth}{0.4pt}} % Horizontal rule
\vspace{-5pt} % Reduce whitespace after the rule slightly
}

Usage:

\namesection[height=2cm]{YosemiteSam}% Your graphic file + optional argument for \includegraphics
{Aravindh}{Sampathkumar}{ % Your name
\href{mailto:aravindh@fastmail.com}{aravindh@fastmail.com } \\+1 864 643 8729% Your contact information
}

Result: enter image description here