Drupal Image Upload

drupal.gif

I had to get the image-upload facility working on a new Drupal site, using a combination of TinyMCE and IMCE. I’d have despaired and/or gone mad if I hadn’t previously managed the same on another site, maybe more by luck than judgement.

In the new site, TinyMCE was basically working, had some buttons configured, including the one for Insert/edit Image. <img src="TinyMCE-ImageEdit.gif">. When I clicked this, I correctly got a small dialog box <img src="TinyMCE-ImageDialog.gif">. However, clicking on the “Browse” button produced no response. I compared the working and non-working setups for access roles, rules, permissions and so on. After a little while I spotted the clue in the IMCE README.TXT file:

Make sure you have the closure variable in your theme file. It contains the html that activates browse button for WYSIWYG editors. For phptemplate based themes, closure is $closure inside page.tpl.php.

Indeed this explained all, and was very unexpected. For the newer site, I had of course rebuilt the whole template, and overlooked these little pesky details. All you need to do is this:

<?php print $closure ?></body></html>

in page.tpl.php

Top of page