[Tex/LaTex] How to add a png icon on the right side of a tcolorbox title

tcolorbox

I'm writing a programming book for novices and I'm making some text boxes to focus attention on them, like "Tips", "Warning", "Focus on" and so on. For now I'm using tcolorbox and I'm very happy with it, but I would like to add some small icons on the right (or left) side of the title bar. Another option could be to remove the title bar and add a side bar with the icon. In the manual of tcolorbox I have found several examples, but none of them show how to load images and add on the title bar. Any help would be wery appreciated.

[EDIT]

Here is a minimal example of my code:

\documentclass[10pt]{book}
\usepackage[english]{babel}
\usepackage{lipsum}
\usepackage[breakable]{tcolorbox}

% ----------------------------------------------------------------
\begin{document}

\begin{tcolorbox}[breakable,arc=0mm,colback=gray!5,colframe=gray,title=Warning!]%
\lipsum[1]
\end{tcolorbox}

\end{document}
% ----------------------------------------------------------------

The code rendered:
enter image description here
I would like something like:
enter image description here
or even:
enter image description here

Another option could be

\documentclass[10pt]{book}
\usepackage[english]{babel}
\usepackage{lipsum}
\usepackage[breakable]{tcolorbox}

% ----------------------------------------------------------------
\begin{document}

\begin{tcolorbox}[breakable,arc=0mm,colback=gray!5,colframe=gray,leftrule=12mm]%
\lipsum[1]
\end{tcolorbox}

\end{document}
% ----------------------------------------------------------------

Rendering:
enter image description here
And the mokup:
enter image description here

That's all 🙂

Best Answer

The package tcolorbox provides the option overlay and some other friends. A simple solution for your left part can be:

\documentclass{article}
\usepackage{graphicx}
\usepackage[most]{tcolorbox}

\newtcolorbox{lattention}{breakable,enhanced,arc=0mm,colback=gray!5,colframe=gray,leftrule=12mm,%
overlay={\node[anchor=north west,outer sep=2pt] at (frame.north west) {\includegraphics[width=8mm]{attention}}; }}

\usepackage{lipsum}
\begin{document}
\begin{lattention}
\lipsum[2]
\end{lattention}

\begin{lattention}
\lipsum
\end{lattention}
\end{document}

Of course you need the picture attention. After this the result will be:

enter image description here

The adjustment is yours ;-)