Original link open a new window?

highlife99 - February 10, 2007 - 23:21
Project:Image
Version:5.x-1.x-dev
Component:image.module
Category:feature request
Priority:minor
Assigned:Unassigned
Status:closed
Description

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.

#1

theshap - February 13, 2007 - 02:23

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

#2

gregrmay - February 27, 2007 - 04:33

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!

#3

drewish - March 21, 2007 - 16:49

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

#4

drewish - April 1, 2007 - 00:54

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

#5

drewish - April 17, 2007 - 16:05

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

#6

dindon - April 23, 2007 - 01:29

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

#7

Leiche - May 5, 2007 - 16:50

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

#8

isko - June 1, 2007 - 23:55

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

#9

drewish - June 12, 2007 - 05:49

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

#10

drewish - June 12, 2007 - 14:12

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

#11

dindon - June 13, 2007 - 08:19

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

THanks and Regards,

#12

drewish - June 29, 2007 - 01:01
Status:active» patch (code needs review)

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

AttachmentSize
image_117915.patch8.06 KB

#13

drewish - June 30, 2007 - 00:06
Status:patch (code 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.

#14

Anonymous - July 14, 2007 - 00:16
Status:fixed» closed
 
 

Drupal is a registered trademark of Dries Buytaert.