How to have pictures open to new page instead of in the pare

Sharondippity
Sharondippity's picture

Joined: 2002-09-01
Posts: 7
Posted: Tue, 2002-09-03 05:52

I installed Gallery for a friend and they were wondering if it were possible to have pictures open into a new page and then click anywhere on the picture to close it?

 
pomeroyt
pomeroyt's picture

Joined: 2002-10-14
Posts: 18
Posted: Mon, 2002-10-14 17:01

The following has only been tested will gallery 1.3.1 ... but it should allow you to have the full image popup in a new window ...

added the following to util.php

function popup_full($url) {
$url = "'$url'";
$window = "Full";
$attrs = "height=600,width=600,location=no,scrollbars=yes,menubars=no,toolbars=no,resizable=yes";
return popup_js($url, $window, $attrs);
}

change line #397 of view_photo.php from
echo "<a href=" . makeAlbumUrl($gallery->session->albumName, $id, array("full" => 1)) . ">";
to
echo '<a href="#" onClick="'.popup_full("$photoURL").';return false">';

 
pomeroyt
pomeroyt's picture

Joined: 2002-10-14
Posts: 18
Posted: Tue, 2002-10-15 01:24

I made a couple adjustments to my popup_full function ... this one does everything that you asked ... it even closes the window :smile:

function popup_full($url) {
$window = "Full";
$attrs = "height=600,width=600,location=no,scrollbars=yes,menubars=no,toolbars=no,resizable=yes";

$newpagehead = "<html><head><title></title></head><body bgcolor=black leftmargin=0 topmargin=0 marginwidth=0 marginheight=0><br />";
$newpageisrc = "<a href=# onclick=javascript:self.close()><img src=$url border=0 /></a><br />";
$newpagetail = "<br /></body></html>";

return "javascript:nw=window.open('','$window','$attrs');nw.document.write('$newpagehead');nw.document.write('$newpageisrc');nw.document.write('$newpagetail');nw.document.close();nw.opener=self;nw.focus();return false;";
}

once again ... I've only tested this on gallery 1.3.1 ... so let me know if it works for you.

 
josephp

Joined: 2002-10-03
Posts: 172
Posted: Thu, 2002-10-24 20:29

your code doesnt work

what I have to do to be exact? your not making it clear ...

I would like to have this feature!

 
[Syntax]

Joined: 2002-10-26
Posts: 20
Posted: Sun, 2002-10-27 01:26

That code works perfect.. Im using Gallery 1.3.1 and I threw that code into my install in less than 2 minutes...
Was very simple..
I put the code with the close when clicked on picture, at the very top of my
utils.php
and then I edited the view_photo.php to have the new "full" line
I commented out the old one using // just in case it didnt work..
and reloaded the page.. works great..

 
pomeroyt
pomeroyt's picture

Joined: 2002-10-14
Posts: 18
Posted: Tue, 2002-10-29 03:20
Quote:
your code doesnt work

what I have to do to be exact? your not making it clear ...

I would like to have this feature!

Not really sure how to make it any clearer ... but here's a shot ...

Insert the following into util.php under your gallery directory

function popup_full($url) {
$window = "Full";
$attrs = "height=600,width=600,location=no,scrollbars=yes,menubars=no,toolbars=no,resizable=yes";

$newpagehead = "<html><head><title></title></head><body bgcolor=black leftmargin=0 topmargin=0 marginwidth=0 marginheight=0><br />";
$newpageisrc = "<a href=# onclick=javascript:self.close()><img src=$url border=0 /></a><br />";
$newpagetail = "<br /></body></html>";

return "javascript:nw=window.open('','$window','$attrs');nw.document.write('$newpagehead');nw.document.write('$newpageisrc');nw.document.write('$newpagetail');nw.document.close();nw.opener=self;nw.focus();return false;";
}

edit view_photo.php under you gallery directory

comment out line #397
echo "<a href=" . makeAlbumUrl($gallery->session->albumName, $id, array("full" => 1)) . ">";

add the following line directly under line #397
echo '<a href="#" onClick="'.popup_full("$photoURL").';return false">';

hope that helps ...

 
thebign

Joined: 2003-01-14
Posts: 11
Posted: Wed, 2003-02-05 22:26

Hi

It works for me in Gallery version. 1.3.3

 
Sharondippity
Sharondippity's picture

Joined: 2002-09-01
Posts: 7
Posted: Thu, 2003-03-06 20:03

Sorry to take so long to follow up on this. I implemented your code successfully, and it kinda works. It opens in a pop up window , on the second click. In other words, when you click the thumbnail, the resized pic doesn't open in the new window, but when you click on the resized pic, the full sized pic does open in a popup. If a pic doesn't have a full sized pic it still does not open in a pop up. Am I saying this at all right? Take a look at <!-- BBCode Start --><A HREF="http://sharonrenshaw.com" TARGET="_blank">My Site</A><!-- BBCode End --> click on the photos link.

Thanks for your time.

 
Mountain

Joined: 2003-04-05
Posts: 9
Posted: Sun, 2003-04-06 01:53

I was wondering if there has been an update to this code, or if someone can tell me how to tweak it to perform the way Sharondippity is asking. I'm using 1.3.3 and have got it to work, but instead of loading a full sized picture on the second click in a new window, I want to be able to load the resized picture in a new window when clicked from the thumbnail while keeping the thumbnail view untouched.

Thank you.

 
yoyodim

Joined: 2003-04-20
Posts: 9
Posted: Sun, 2003-04-20 17:02

yes i also want that. that when i click on the thumb the full sized opens in a new window, becouse i use it to display walpapers in a postnuke environment, and when they load they go way outside my window...

if anywone know how to do this?

 
Mountain

Joined: 2003-04-05
Posts: 9
Posted: Mon, 2003-05-12 23:05

Well, i've been plugging away at this and looking through the forums and found something that worked for me. My goal wasn't just to have the photo show in another window, but to mask the actual file from web-bots that will download an entire website in one fell swoop. What I did was change the
inline_photothumb.frame.default from:

<td><a href="<?php echo $href ?>"><?php echo $tag ?></a></td>

to

<td>
<A HREF="*.htm" onClick="window.open('<?= $href ?>','mywindow','width=800,height=600,left=-1,top=-1,scrollbars=yes,resizable=yes,location=no');return false">
<?php echo $tag ?></a></td>

and then edited the view_photo.php and remarked out the top nav bar and bottom nav bar so only the picture is visbile. What I did leave visible was the comments section since I really like that feature. Hope this helps everyone.

 
beckett
beckett's picture

Joined: 2002-08-16
Posts: 3474
Posted: Tue, 2003-05-13 07:40

Guido Stein (gsteinmon) has a patch for this:
http://sf.net/mailarchive/message.php?msg_id=3786723
Here's another relevant post:
http://gallery.sf.net/forums.php?topic=616

-Beckett (

)

 
thesoarer
thesoarer's picture

Joined: 2002-10-05
Posts: 22
Posted: Thu, 2003-07-17 18:39

Well, I just got the first one working in Gallery 1.3.4.

What I would like to do now is make the full link the upper right hand corner open in a new window like it does when you click the picture. How would I do that?

In view_photo.php on line 378, when I replace this:
$adminCommands .= "normal | <a href=\"$link\">full</a> ]";
With this:
$adminCommands .= "normal | <a href="#" onClick="'.popup_full("$photoURL").';return false">full</a> ]";

I get parse errors...

 
joan
joan's picture

Joined: 2002-10-21
Posts: 3473
Posted: Thu, 2003-07-17 19:59

You need to escape your quotes, viz:

$adminCommands .= "normal | <a href=\"#\" onClick=\"'.popup_full(\"$photoURL\").';return false\">full</a> ]";

 
thesoarer
thesoarer's picture

Joined: 2002-10-05
Posts: 22
Posted: Thu, 2003-07-17 20:04

I tried that, but I will try again...

 
thesoarer
thesoarer's picture

Joined: 2002-10-05
Posts: 22
Posted: Thu, 2003-07-17 20:10

Ok, it isn't giving me parse errors anymore, but still won't load the full image in a new window, it just stays on the same page.

 
milfeulle

Joined: 2003-07-21
Posts: 1
Posted: Mon, 2003-07-21 09:54

Using FreeBSD 5.1 APACHE 1.3.X PHP 4.3.X

GALLERY 1.3.4 ... I did after the instructions... It works fine.. :D

Very appreciated for Your Help.. thnx..

 
peskin

Joined: 2003-08-15
Posts: 2
Posted: Sun, 2003-08-17 20:30

I recently found and setup gallery and have been trying to figure out how to customize it with the modifications outlined in this topic.

The gallery is setup here.

My util.php and view_photo.php can be seen here and here respectively.

I have added the function full_popup() code to the util.php and the line
--> echo '<a href="#" onClick="'.popup_full("$photoURL").';return false">'; <--

after commenting out the original line.

I have also made the replacement for the line beginning with
--> $adminCommands .= "normal <--
as described above.

Again, I have posted the text files of the util and view_photo files for your review.

Can someone please tell me what I have overlooked. These modifications seem to have no effect.

I am using:
Gallery v1.3.4-pl1
PHP 4.3.2

Thank you.

 
Yume_Dream

Joined: 2003-08-23
Posts: 1
Posted: Sat, 2003-08-23 22:33
pomeroyt wrote:
Quote:
your code doesnt work

what I have to do to be exact? your not making it clear ...

I would like to have this feature!

Not really sure how to make it any clearer ... but here's a shot ...

Insert the following into util.php under your gallery directory

function popup_full($url) {
$window = "Full";
$attrs = "height=600,width=600,location=no,scrollbars=yes,menubars=no,toolbars=no,resizable=yes";

$newpagehead = "<html><head><title></title></head><body bgcolor=black leftmargin=0 topmargin=0 marginwidth=0 marginheight=0><br />";
$newpageisrc = "<a href=# onclick=javascript:self.close()><img src=$url border=0 /></a><br />";
$newpagetail = "<br /></body></html>";

return "javascript:nw=window.open('','$window','$attrs');nw.document.write('$newpagehead');nw.document.write('$newpageisrc');nw.document.write('$newpagetail');nw.document.close();nw.opener=self;nw.focus();return false;";
}

edit view_photo.php under you gallery directory

comment out line #397
echo "<a href=" . makeAlbumUrl($gallery->session->albumName, $id, array("full" => 1)) . ">";

add the following line directly under line #397
echo '<a href="#" onClick="'.popup_full("$photoURL").';return false">';

hope that helps ...

I can confirm that this also works with Gallery v1.3.4-pl1

But in view_photo.php, you will need to go to line #488

^_^

 
Roo
Roo's picture

Joined: 2003-07-16
Posts: 88
Posted: Wed, 2003-08-27 01:59

Okay before I go messing........

Will this code cause *all* images to open in a popup or just where you include the bits in the a tag?

I need to open just *two* things in a popup from within Galley...both are html files, one contains a Flash slideshow, the other a java slideshow.

I don't want all of the images to open in popups or new windows..just those two. So would this work for my needs?

Before I go messing........................... :wink:

*Edit*
I have tried to use the same onclick jazz that opens the comments etc in thier popups, but I wasn't successful in trying to edit things to make them display the url that I need to open this way.

 
Roo
Roo's picture

Joined: 2003-07-16
Posts: 88
Posted: Wed, 2003-08-27 02:45

Never mind I got it!

I just pasted the script that I always use from Dynamic Drive into veiwalbum.php and included the link as a text caption link and it's working fine in Opera....need to go check in other browsers, and it it's okay across the board I'll need to do the same thing with viewphoto.php.

 
wborrelli
wborrelli's picture

Joined: 2003-07-18
Posts: 3
Posted: Wed, 2003-08-27 13:14

Works in 1.4 RC1, but look at line 506.

 
H2O

Joined: 2003-10-17
Posts: 2
Posted: Fri, 2003-10-17 09:38

Can some please make this so the photo's will open in a pop up window from the photo index?

 
joan
joan's picture

Joined: 2002-10-21
Posts: 3473
Posted: Fri, 2003-10-17 15:18
H2O wrote:
Can some please make this so the photo's will open in a pop up window from the photo index?

I don't understand the question. What exactly do you want?

 
H2O

Joined: 2003-10-17
Posts: 2
Posted: Tue, 2003-10-21 17:37

Please take a look at: http://www.sportstudio-backtobasics.nl/gallery/

If you go to a album and click on a photo on the photo index a popupwindow will appear. Now if you click on it a second time then another popup window will be opened and this time people can click the photo to close that window. I would like that to happen with the first popup window. Highly prefered! To only have a previous and next text link in that window. Not the whole gallery interface.

 
yed

Joined: 2003-10-21
Posts: 2
Posted: Tue, 2003-10-21 20:08

Hi, I make it work in gallery v1.4.1-cvs-b157. First a disclaimer I have no idea of php or html...this was simple old style try and error programming.

I chaged line 604 from:
$href= makeAlbumUrl($gallery->session->albumName, $id, array("full" => 1));
to:
$href= '"#" onClick="'.popup_full("$photoURL").';return false"';

Now I wonder if it is possible to add some user interface feedback, like a mouseclick sound when clicking in the picture and changing the mouse cursor to an hourglass while waiting for the window to pop-up.

Thanks

 
infield

Joined: 2003-12-17
Posts: 1
Posted: Wed, 2003-12-17 20:12

In 1.4.1 its line 609 from:
$href= makeAlbumUrl($gallery->session->albumName, $id, array("full" => 1));
to:
$href= '"#" onClick="'.popup_full("$photoURL").';return false"';

Thanks

 
gsbe
gsbe's picture

Joined: 2004-01-27
Posts: 33
Posted: Sat, 2004-05-08 22:14

I was able to get the largest size picture to open in a new window with these fixes to util.php and view_photo.php in the latest stable version of Gallery (v1.4.3-pl1), but I need further customization:

How can you get all the pictures to open in a new window? I would like to view the albums and thumbnails in the main page but view any larger versions in a new window. Any help would be appreciated.

I would like to see these features added to the Gallery configuration setup. Perhaps this should be an option per album. Controlling popup windows for large images is critical to a successful integration of Gallery into an existing website or CMS. Displaying large images within a template many times makes the website look unprofessional. Easy choices regarding popup windows would alleviate these integration issues and may bring a larger audience to Gallery.