iimage_browser : nice thumbnail > link > popup hack
-
I thought I’d share this use of the lovely iimage_browser plugin by Martin Chlupac …
This uses it’s “custom code thumb” option to put a thumbnail in a post which when clicked pops up a perfectly-sized window with the full image.
The popup routine is a Javascript function and must be put into /wp-admin/quicktags.js so it’s there when needed. Put the following anywhere in quicktags.js:
function ViewImage(ifile,ix,iy)
{
var ititle = “Click to close” ;
var win = window.open(“”,”imageviewer”,”width=”+ix+”,height=”+iy+”,menubar=no,toolbar=no”);
win.document.open();
win.document.write(“<html><head><title>”+ititle+”</title>”);
win.document.write(“</head><body onBlur=\”self.close()\” onClick=\”self.close()\”>”);
win.document.write(‘<div style=”position:absolute;width:’+ix+’px;height:’+iy+’px;left:0px;top:0px”>’);
win.document.write(“<img src=\””+unescape(ifile)+”\”></div></body></html>”);
win.document.close();
}Then in /wp-admin/iimage_browser.php find and make this variable read as follows:
$ib_custom_code_thumb = ‘<img style=”float: left; margin: 0 10px 0px 0; display: inline;” src=”%tsrc” title=”%title” alt=”%title” width=”%twidth” height=”%theight” border=”0″ />‘;
NOTES
– Works with iimage_browser v1.4.5 beta (the latest).
– Seems to work well with different browsers.
– When clicked or unfocused, the popup closes.
– Style: you can adjust the style=”…” element to your preference, or remove it to let your theme CSS handle the image style.
- The topic ‘iimage_browser : nice thumbnail > link > popup hack’ is closed to new replies.