I want to add a pinterest button to joomla articles, and I achieved it by adding the code:
But this code adds the button to all images in the page. How can I add it only to the main article image?
I'd suggest writing a small/simple Content Plugin (see the developer tutorial link). The Joomla SE site has a question/answer that discusses customizing images for articles - it may be a good starting point for you.