Ok here's my problem: I want thumnails on pages with a javascript popup window. This is easy to do with a one line fix in the img_assist.module

Change line 813:

    $img_template = t($img_template, array('%caption' => $vars['caption'], '%node-link' => url("node/$image->nid"), '%img-link' => $image->filepath, '%alt' => check_plain($vars['alt']), '%width' => $width, '%height' => $height, '%src' => $src, '%image-class' => $class));

To

    $img_template = t($img_template, array('%caption' => $vars['caption'], '%node-link' => url("node/$image->nid"), '%img-link' => $image->filepath, '%alt' => check_plain($vars['alt']), '%width' => $width, '%height' => $height, '%src' => $src, '%image-class' => $class, '%orig_src' => file_create_url($image->filepath), '%orig_height' => $image->height, '%orig_width' => $image->width));

Now, we just need to add support in the img_assist configuration. You'll need to put this in link form- i couldn't post the whole text here because it kept saying it was suspcious!

openWindow('%orig_src','window','%orig_width','%orig_height','20','yes');" ><img src="/%src" width="%width" height="%height" alt="%alt" /></a>

And finally, a JavaScript function to tie it all together:

function openWindow(url, name, w, h, perc, scrollbars) {
  // initialize winX and winY to default values
  // for cases where Screen object isn't supported
  var winX = 0;
  var winY = 0;

  // only set new values if 4.0 browser
  if (parseInt(navigator.appVersion) >= 4) {
    winX = (screen.availWidth - w)*perc*.01;
    winY = (screen.availHeight - h)*perc*.01;
	}
  popupWin = window.open(url, name, 'width=' + w + ',height=' + h + ',left=' + winX + ',top=' + winY + ',scrollbars=yes, menubar=yes,resiable=yes');
}
CommentFileSizeAuthor
#3 properties.js_0.patch902 bytesarthurf
#2 img_assist.module_4.patch860 bytesarthurf

Comments

benshell’s picture

Assigned: Unassigned » benshell

Thanks for this patch. I've integrated this into my version of img_assist for Drupal 4.7 (http://drupal.org/node/32506) that will soon become the official version of img_assist for 4.7 and newer. I ended up doing things a little differently, but it'd be great if you could test my version and let me know if it meets your needs.

arthurf’s picture

Title: Add Popup Windows to thumbnails » Patched version for 4.6
StatusFileSize
new860 bytes

Here's the patch for the img_assist.module to do this. Next post will include the patches needed on the javascript. I realized that there were a bunch of problems how I did this originally and it was throwing a bunch of js errors.

arthurf’s picture

Title: Patched version for 4.6 » javascript patch
StatusFileSize
new902 bytes

here's the patched javascript file that correctly filters the %orig_ values

darren oh’s picture

Status: Active » Closed (fixed)