Is it possible using drupal 5.1 and the latest version of image.module to allow the original size image to open in a new window? I searched and did find solutions for older versions but could not get them to function. Any help would be appreciated.

CommentFileSizeAuthor
#12 image_117915.patch8.06 KBdrewish

Comments

theshap’s picture

I'm in exactly the same boat! Any info on this would be greatly appreciated!

gregrmay’s picture

I would also love to know! I took a look at the function, but am not clear on how to create the new window and place the image inside.... Thanks!

drewish’s picture

marked http://drupal.org/node/129707 as a duplicate of this.

drewish’s picture

marked http://drupal.org/node/132826 as a duplicate

drewish’s picture

marked http://drupal.org/node/136963 as a duplicate

dindon’s picture

method above is not working for image 5.x-1.x!

Leiche’s picture

Having the same problem with Drupal 5.1 and Image 5.x-1.x.
Got some huge Wallpapers on my page, that do not fit into the content block. So they are overlapped by the right sidebar.
I'm a complete newbie to Drupal and PHP, so I have to relate on you coders out there.
Please help :)

Leiche

isko’s picture

I have found the solution. You have to replace the last line in the image_link function, so that it looks like this:
$links['image_size_original'] = array('title' => t('original'), 'href' => 'system/files/' . $node->images['_original'], 'attributes' => array('target'=>'_blank'));
Maybe, you will have to change the image path prefix 'system/files/' to match your configuration.

Unfortunately, I have a problem when trying to integrate this as an overriden function in my theme, so that I don't have to change the image.module. I've tried to add the modified function to my template.php:

function scorpions_image_link($type, $node, $main = 0) {   
  $links = array();
  
  if ($type == 'node' && $node->type == 'image' && !$main) {
    $request = ($_GET['size']) ? $_GET['size'] : 'preview';
    foreach (_image_get_sizes() as $size) {
      if ($node->images[$request] != $node->images[$size['label']]) {
        $links['image_size_'. $size['label']] = array('title' => t($size['label']), 'href' => 'node/' . $node->nid, 'query' => 'size=' . urlencode($size['label']));
      }
    }
    if (user_access('view original images') && ($node->images[$request] != $node->images['_original'])) {
      $links['image_size_original'] = array('title' => t('original'), 'href' => 'system/files/' . $node->images['_original'], 'attributes' => array('target'=>'_blank'));
    }  }

  return $links;
 } 

but it has no effect. Anyone please help, I have no experience with functions overriding yet?
---
www.scorpions.sk

drewish’s picture

marked http://drupal.org/node/144999 as a duplicate

drewish’s picture

marked http://drupal.org/node/151136 as a duplicate

dindon’s picture

how to open image only in the new window? the method above is working but it include the sidebar/theme.

THanks and Regards,

drewish’s picture

Status: Active » Needs review
StatusFileSize
new8.06 KB

okay here's a patch that takes a first crack at this.

drewish’s picture

Status: Needs review » Fixed

okay i'm going to go ahead and commit this. people have been asking for it for as long as i've been working on the module and i closed a bunch of duplicate issues from before that. we can work any bugs out later.

Anonymous’s picture

Status: Fixed » Closed (fixed)