I am writing an element and want to place images in the template folder.

How can you obtain the correct road to web site folder?

IIRC, the $mainframe global object is eventually disappearing. This is a method of doing it with the framework:

$application = JFactory::getApplication()

$templateDir = JURI::base() . 'templates/' . $application->getTemplate()

I have determined one way. Make use of the global $mainframe object.

$templateDir = $mainframe->getBasePath() . "templates/" . $mainframe->getTemplate()

Can there be another (better) way?

What type of path... On filesystem:

$templateDir = JPATH_Styles.DS.JFactory::getApplication()->getTemplate().DS