Just have a look at this script which is brought to you by pinterest.com/about/goodies: "Pin It Button for Web Sites". Deobfuscate it at http://jsbeautifier.org/ and see what it does:
- It takes all
<a>
elements in the document and when their href
attribute contains the string "//pinterest.com/pin/create/button/?"
,
- it replaces them with a iframe (http://pinit-cdn.pinterest.com/pinit.html?...), its properties depending on the URI and other attributes of the link.
Now, you should be able to write a script that takes all your buttons, grabs the image next to it (However that will work, depends on your DOM) and creates such iframes.
If you don't want the popups, you might have a look at the iframes / popups source code and post directly to the address you find there.
I've come across is these two sites:
http://www.nextscripts.com/pinterest-automated-posting is a non-free wordpress plugin, including an API for posting to pinterest (because they don't have one themselves). You can only guess what happens in the PHP code until you buy it.
http://www.brandaiddesignco.com/blog/add-a-custom-pinterest-pin-it-button-to-your-website/375/# just dynamically loads this script when you click on that button, and the script then creates a GUI to select images from the page.