The questions are in this document.
\documentclass{article}
\usepackage{graphicx, tabularx}
\usepackage[nopar]{lipsum}
\newenvironment{centerentry}[2][]
{\renewcommand{\tabularxcolumn}[1]{m{##1}}
\noindent
\tabularx{\linewidth}{ @{} m{\imagecolwidth} X @{} }
\includegraphics[width=\linewidth,#1]{#2} &
}{%
\endtabularx%
}
\newlength{\imagecolwidth}
\setlength{\imagecolwidth}{2em}
\sloppy% Just for this example
\begin{document}
\section{Is it possible to get this text line and the two pictures centered?}
\begin{centerentry}[height=4ex, width=4ex]{example-image-a} horizontal centered? \includegraphics[height=8ex]{example-image-b}\\
\end{centerentry}
\section{This text is centerd to the picture.}
\begin{centerentry}[height=4ex, width=4ex]{example-image-a}
This text is centerd to the picture.
\end{centerentry}
\section{Third text is not centerd.}
\begin{centerentry}[height=4ex, width=4ex]{example-image-a}
This text is centerd to the picture.
\end{centerentry}
\begin{centerentry}[height=4ex, width=4ex]{example-image-a}
This text is centerd to the picture.
\end{centerentry}
\begin{centerentry}[height=4ex, width=4ex]{example-image-a} horizontal centered? \includegraphics[height=8ex]{example-image-b}\\
\end{centerentry}
\begin{centerentry}[height=4ex, width=4ex]{example-image-a}
This text is centerd to the picture.
\end{centerentry}
\begin{centerentry}[height=4ex, width=4ex]{example-image-a}
This text is centerd to the picture.
\end{centerentry}
\section{More than one text line: Output is OK. Of course it would be nice if the text is around the Picture B.}
\begin{centerentry}[height=4ex, width=4ex]{example-image-a}
Write some text to get more lines. Write some text to get more lines. To see. Write some text to get more lines. More lines. Write some text to get more lines. \includegraphics[height=8ex]{example-image-b} Write some text to get more lines. Write some text to get more lines.
\end{centerentry}
\section{With Photoshop:}
\begin{centerentry}[height=4ex, width=4ex]{example-image-a} horizontal centered? \includegraphics[height=8ex]{example-image-b}\\
\end{centerentry}
\end{document}


So is it possible to connect \setlength{\imagecolwidth}{2em} and [width=1\textwidth] in \includegraphics
so that I had to define the wanted width of the picture only once?
@ David: Thank you for your example: Is it possible to change each picture in the size, especially the width?
– user145530 Oct 12 '17 at 17:24\usepackage[export]{adjustbox}and\includegraphics[valign=c,width=4ex]{example-image}? – Torbjørn T. Oct 12 '17 at 17:39\includegraphicsas you show in your code above. – David Carlisle Oct 12 '17 at 18:36