I'd like to change IMCE's hard-coded tMaxW, tMaxH, prvW and prvH settings (from imce-content.tpl.php) in my theme, but there seems to be no clean way of achieving this. When I add a line like
$.extend(imce.vars, {tMaxW: 800, tMaxH: 800, prvW: 64, prvH: 64});
to my theme's $.ready() handler (which is contained in a JavaScript file loaded by drupal_add_js() in template.php) it has no effect. I guess those IMCE settings are read before my theme's $.ready() code is even executed, and any further changes to imce.vars are lost.
I tried all sorts of ways of getting my theme's JavaScript file to be included in the document after IMCE's JavaScript code, so that rather than executing it on $.ready() the browser executes it in-line, hopefully overriding the values set by imce-content.tpl.php. Unfortunately, no method worked. The one method that I think should have worked and would probably have been a good solution was to tell drupal_add_js() to place my theme's script into the "footer" script section, which is supposed to be output in the $closure variable provided by PHPtemplate. However, even after I added the line
print $closure;
to the end of imce-page.tpl.php (which probably should have been there anyway, no?), nothing gets printed out. I can't figure out why that is, because it inserts the script into the header as expected, just not into the footer/closure.
So I've been unable to find any way to override the IMCE's hard-coded thumbnail settings without actually hacking the "imce" module, which then get overwritten upon each upgrade.
Suggested solution...
I think IMCE should provide administrators a way of modifying these settings in its administration screens rather than requiring the theme developer to use jQuery or other JavaScript to override them.
Comments
Comment #1
ufku commentedThe cleanest way, i can tell, is to copy imce-content.tpl.php to your theme's directory and change it the way you like.
You're right about the missing footer scripts. I've just added drupal_get_js('footer') to the page footer. Your footer script will probably work now(without ready() implementation).
Comment #2
ufku commented