Hi,
I want users to click on thumbnails and "ALWAYS" open the images in a new window(i.e. have a new web-browser window wiht only the image in it) instead of within the same window.?
I checked the thread and apparently they hadn't figured it out. Their goal was slightly different: to make a full sized image to appear as a popup, what i'm trying to do is simply click on thumbnail and opens the regular medium sized photo page in a new window this way people can view the thumbnails and picture at the same time, but in G2b4...i think the other guy had b1.
nivekiam
Joined: 2002-12-10
Posts: 16504
Posted: Tue, 2005-08-02 04:02
I've been talking to bharat on irc on how to do this. It's possible, but not efficient. He started down the path of getting me the answer, but we stopped when he suggested it might be easier to just edit photo.tpl to render only the image. Here's the useful stuff from our conversation:
Quote:
<bharat> sure .. if you know the id of the resize you can do
<bharat> {g->url arg1="view=core.DownloadItem" arg2="itemId=`$derivativeId`"}
<bharat> that'll give you the url directly to the iamge
<nivekiam> so would the id of the resize be the same as $child.id in album.tpl?
<bharat> the short answer is "no"
<bharat> but I can tell you how to get it
<bharat> so the child.id is the id of the GalleryPhotoItem
<bharat> it's got 2-3 derivatives (1 thumbnail, 1-2 resizes)
<bharat> so the trick is to get the derivative ids at the same time as we fetch the thumbnails
<bharat> we don't do that though for efficiency (since we don't use it)
<bharat> so he'd need to figure out which resize he wants (there can be more than one, of course) and then link directly to that resize
<bharat> this is not *hard* but it requires writing a little code
<nivekiam> yeah, I can only see people using this with custom themes, esspecially since they'll probably need to use javascript to for a custom sized pop-up
<bharat> it might be easier to change photo.tpl to just render the <img>
<bharat> and then use a _target on the <a> in album.tpl
That's when I started editing photo.tpl, theme.inc and creating a new "wrapper" for photo.tpl on my site. I'm lazy and didn't put in the extra 5 seconds of work to edit album.tpl to open the link in a new window. ;) Check out my site for an example: removed link, it doesn't contain modifications any longer those changes will be there for a couple of days or at least until I update from CVS again.
Here's what I did:
NOTE: You may want to create a new theme as at least one of your changes could be overwritten by an upgrade. Theme.inc cannot be made 'local', thus it's overwritten on every upgrade, if the theme exists in an upgrade.
1) created a 'local' directory under /themes/matrix/templates and copied photo.tpl into it. You'll want album.tpl as well
3) created a new file imaginatively called 'none.tpl' in the same 'local' directory and copied the contents of theme.tpl into it. Then I cut out the stuff I didn't want, breadcrumb, the image at the top, the images at the bottom, etc
4) edited theme.inc and revised the showPhotoPage() function to return 'none.tpl' instead of 'theme.tpl'
That's pretty much it. You'll want to edit album.tpl to open the link in a new window and you may want to use javascript or what ever you want to open the new window. Gotta go the Closer is on ;)
Hi, I followed your instructions to the last step...which again, is the final code for creating the new window. I'm sorry but I have no background in PHP or java or whatever the code is for album.tpl. So I went online and looked for new window scripts and tried pasting them but no luck....I also looked at the other link, but they hadn't figured it all the way out yet...and I also checked out your site and navigated all over the test pages, but did not find an example of an album thumbnail opening a new window. we're soo close, all I need is that five seconds you lazed out on! :D
hi all,
trying to do the popup-thing for the fullsize images. in gallery 1.x, if i remember right, there was a parameter in admin menu to select "popup yes/no". is this paramter gone in g2 beta4? how can i do this with g2 b4? the procedure must be different then above in some steps, i think
That works if you're not showing image frames or want to show the original item (downloadItem). Either way, in my gallery I have full size images restricted to logged in users so I got an error if I wasn't logged in because I'm also using image frames...
All you really have to change is this:<a href="{g->url arg1="view=core.ShowItem" arg2="itemId=`$child.id`"}">
to this:<a href="{g->url arg1="view=core.ShowItem" arg2="itemId=`$child.id`"}" target="_blank">
szac
Joined: 2003-07-08
Posts: 26
Posted: Thu, 2005-08-25 13:59
This is SWEET!! Is it possible to get it to work with RC2? Since the theme.inc system is gone, where would I modify theme.tpl to get it to return photo.tpl in a different template other than theme.tpl?
Except my site doesn't have that modification in it any longer.
szac
Joined: 2003-07-08
Posts: 26
Posted: Thu, 2005-08-25 17:49
WOW. I totally missed it (was looking in /templates!). Thanks so much for this mod. I've been trying to get something likes this working with G1 for quite some time. Now I'll try to throw some js in there for some nice sized popup windows! CHEERS
szac
Joined: 2003-07-08
Posts: 26
Posted: Thu, 2005-08-25 23:28
I found a nice javascript that'll resize the window to the image and add some pixels for the nav and what not. The only problem is that it requires the dimensions of the image to set the size. I'm thinking it's in $photoItem-> somewhere but am clueless to pull it off. I know i have to set the width and hieght as variables and then call them in the js function.
How do I call the image dimensions and set them as variables?
Thanks Alot! With the javascript working properly I should be able to get my gallery to function somewhat like the "Photo of the Moment" at http://tumyeto.com/[/url]
swordfish
Joined: 2004-10-01
Posts: 388
Posted: Thu, 2005-09-01 00:19
I'm using WPG2 plugin with latest G2 and Matrix theme. For my Full Size images to popup in a new window I simply added the below code to photo.tpl just above {* Download link for item in original format *}
This is actually the same exact code taken from the photo.tpl file in wordpress theme.
Sweet! Is it possible to get that to link from the album view?
kylemac123
Joined: 2005-09-14
Posts: 16
Posted: Thu, 2005-09-15 01:35
I seem to be missing something... I had it set so that clicking on the resized image would result in the full sized image being opened in a new window back with beta4 and rc2, now it seems that no longer works, and I can't figure out what I did for the life of me. The above posters solution is alright if you want another link below the image, but I want the image itself to be the link. I figured I'd be editing photo.tpl, but now i'm not so sure. Anyone care to point me in the right direction?
Ave
Joined: 2003-05-11
Posts: 19
Posted: Sat, 2005-09-17 21:48
When I use <a href="{g->url arg1="view=core.ShowItem" arg2="itemId=`$child.id`"}" target="_blank"> I see subalbums in another window too. I want to see only photos in a new window.
nivekiam
Joined: 2002-12-10
Posts: 16504
Posted: Sat, 2005-09-17 22:36
kylemac123 and Ave take a look at step 4 above
Quote:
4) edited theme.inc and revised the showPhotoPage() function to return 'none.tpl' instead of 'theme.tpl'
Now I' looking for a javascript. In order to show only the image.
RwD
Joined: 2005-01-09
Posts: 383
Posted: Mon, 2005-09-19 22:08
I haven't read this thread very very closely but I gather two suggested options for having a certain link open in a new window:
- <a href="javascr ipt:void(0);" onclick="wi ndow.ope n('somelink');">
- <a href="somelink" target="_blank">
I don't like either of these methods. Usualy I code using the strict dtd but I guss both methods are not correct to the XHTML dtd either (just guessing here). The first one is bad for obvious reasons; if javascript is impaired the script will not work and even worse; when users do click shift the link tries to go to "java script:voi d(0);" which is clearly wrong.
The second method I don't like because I think that that won't validate or otherwise the attribute was not intended for this use.
My solution involves the attribute rel="external".
Instead of adding target="_blank" add rel="external" to the link and make the following javascript functions available (through inclusion in the page header or by adding it to an existing (and included) .js file)
/*
* Function used to get elements which have a certain classname. The classname does not have to be
* the only classname an object has.
*/
document.getElementsWithExternalRel = function () {
var s = [document.documentElement || document.body], i = 0, r = [], l = 0, e;
var re = new RegExp('^external$'); // '(^|\\s)external(\\s|$)'
do {
e = s[i];
while (e) {
/* Element nodes only */
if (e.nodeType == 1) {
if (e.rel && re.test(e.rel)) r[l++] = e;
s[i++] = e.firstChild;
}
e = e.nextSibling;
}
}
while (i--);
return r;
}
/*
* Open a certain URL in a new window. If a popup blocker prevents this the link is opened in the
* current window.
*/
function fnDOM1Open( event ) {
if ( window.event ) {
var shiftKey = window.event.shiftKey;
} else {
var shiftKey = event.shiftKey;
}
if ( !shiftKey ) {
var strURL = this.href;
var oNewWindow = window.open( strURL );
if ( !oNewWindow ) {
window.location.href = strURL;
}
return false;
} else {
return true;
}
}
/*
* Assign an onclick event handler to all links having the classname "newWindow"
*/
function fnAssignPopupLinks() {
var aAnchorList = document.getElementsWithExternalRel();
i = aAnchorList.length;
while (i--) {
oAnchor = aAnchorList[i];
if ( oAnchor.href ) {
oAnchor.onclick = fnDOM1Open; // DOM level 1 approach
}
}
}
All you need to do then is to call the function fnAssignPopupLinks() at the end of the page and it runs in less then a second time for all browsers adding the onclick event handlers to all links having rel="external"
This way is much cleaner because it validates and does not disable a user from opening a link when javascript is switched off. And when users use the shift key the javascript lets the browser do the default action whatever that might be so it doesn't interfere with intuitive thingies...
norv
Joined: 2004-03-12
Posts: 13
Posted: Fri, 2005-10-07 00:17
I have applied RwD's javascript (above) to my g2 and it is opening the images in a new window when I click the thumbnail.
***NB: I put the script in the header of templates/local/theme.tpl and surrounded the <script></script> tags with {literal}{/literal} tags to escape Smarty's attention.
Now i want the new window to be sized to the image, maybe a tad bigger to take navigation etc.
Any quick answers on how to pass the image dimensions to the script above and output a nice size window?
Thanks
Norv
*see next post
norv
Joined: 2004-03-12
Posts: 13
Posted: Fri, 2005-10-07 02:17
I got a partial solution by adding this code to the header of theme_photo.tpl which is called in my theme.inc in function showPhotoPage.
(My theme_photo.tpl is a copy of theme.tpl with only the photo included on the page)
4 problems with this:
1. I would like to have a second popup automatically close the first popup
2. the album page blanks out for a second while the popup loads
3. when you stop the slideshow it goes to the popup of the current image and closes the album page
4. the margins vary and even disappear on some pix
1, Assign a name to the window like window.open( strURL, 'myGallery' ).
2, ??.
3, That sucks, probably javascript related. Try to find the point where it does this by adding alert( 'message' ); statemants in the code. Naming the window might have solved this already though.
4, I think that depends on the image dimensions. Can you check that the images indeed do get a margin?? (check with firefox + some extentions)
______________________
I made a theme for G2, try it
norv
Joined: 2004-03-12
Posts: 13
Posted: Fri, 2005-10-07 06:06
1. Thanks RwD, I will try that
2. I forgot to add that the function FitPic() in the header of theme_photo.tpl
is called in a <body onLoad='FitPic();'> tag, maybe that causes the album page visible beneath the popup to 'blank out' or reload?
3,4. ditto 1
RwD
Joined: 2005-01-09
Posts: 383
Posted: Fri, 2005-10-07 08:27
2, For some reason or the other IE seems to do blanking out stuff rather often when javascript is involved. If the problem doesn't happen in Firefox then it is probably just that...
______________________
I made a theme for G2, try it
norv
Joined: 2004-03-12
Posts: 13
Posted: Tue, 2005-10-11 02:07
I assigned a name to the window in fnDOM1Open(event) as in var oNewWindow = window.open( strURL, 'myPopup' ,'resize=yes,width=500,height=500');
and now
1. Fixed: the second popup closes the first popup
2. Fixed: the album page stays loaded
3. Not fixed yet - stopping slideshow still shows current image in popup and closes album page
4. Fixed: margins are fine
but
5. Now the second popup loads underneath the album page, despite the self.focus() line in function FitPic(), called when the popup loads
3. Actually it is not closing the album page. The slideshow always stops at the current
picture and returns to the current pictures photo page. If your photo.tpl happens to be the page
opened in the popup, then the main window will look like the popup. You would have to change the
slideshow to go to the album rather then the picture:
Copy the file "modules\slideshow\templates\Slideshow.tpl" to "modules\slideshow\templates\local\Slideshow.tpl"
(create the directory if needed)
It does what you ask, but I think this kind of makes it unclear where you are going to when you press
stop, perhaps you should also add the pagenumber? This will get worse when the slideshow also starts
opening subalbums (doesn't do that yet).
5. The problem is that the onload event fires after all page content has loaded (including images and
other binary content). I found a possible solution for this here.
One thing though here is that you do not have the correct dimensions yet before the image is loaded.
but you'll have that anyway if you get what you want. I am sure that gallery2 can return the image
dimensions with the page (php has these functions build in; you do not even require GD or something
like that...
______________________
I made a theme for G2, try it
RwD
Joined: 2005-01-09
Posts: 383
Posted: Tue, 2005-10-11 07:19
*accidentally pressed post comment*
norv
Joined: 2004-03-12
Posts: 13
Posted: Tue, 2005-10-11 22:01
Thanks RwD, that Slideshow solution works well. I'll keep the sub-album issue in mind.
Currently working thru the possible solution to the onLoad problem.
How did you get a tiger-print rabbit? (Album in your G2 theme)
RwD
Joined: 2005-01-09
Posts: 383
Posted: Wed, 2005-10-12 04:44
norv,
There was a guy in the neighbourhood who had a tiger printed female. It wasn't sure
that her offspring would get them too because the father was a plain grey rabbit. But
some of them where the right color but blank, and some where grey. I bought a blank
one and the stripes appeared later on. Where they come from exactly I don't know.
Perhaps a rabbit came too close to a tiger on a sunny afternoon??
______________________
I made a theme for G2, try it
norv
Joined: 2004-03-12
Posts: 13
Posted: Wed, 2005-10-12 07:35
lol..
I checked out the window.open page you mentioned and tried out a solution..
this is how my theme_photo.tpl looks now
{literal}
<script language="javascript" type="text/javascript"/>
<!-- hide script from older browsers
var NS = (navigator.appName=="Netscape")?true:false;
function initFitPic() {
// quit if this function has already been called
if (arguments.callee.done) return;
// flag this function so we don't do the same thing twice
arguments.callee.done = true;
iWidth = (NS)?window.innerWidth:document.body.clientWidth;
iHeight = (NS)?window.innerHeight:document.body.clientHeight;
iWidth = (document.images[0].width - iWidth) + 15;
iHeight = (document.images[0].height - iHeight) + 20;
window.resizeBy(iWidth, iHeight);
self.focus();
};
/* for Mozilla */
if (document.addEventListener) {
document.addEventListener("DOMContentLoaded", initFitPic, null);
}
/* for other browsers */
window.onload = initFitPic;
// end hiding script from older browsers -->
</script>
<style type="text/css">
/* for Internet Explorer */
body {behavior: url(loaded.htc);}
</style>
{/literal}
</head>
<body class="gallery">
no matter where i put the alerts I can't seem to get focus anywhere.
Ave
Joined: 2003-05-11
Posts: 19
Posted: Fri, 2005-11-04 14:21
After a happy month with my galley showing popups I was asked to install another gallery with same features in another site. Same server, same PHP, same MySQL, of course. But I installed Gallery 2.0.1, the new version.
Not happens and javascript not appears with 'view source code'. I'm working with this for 7 days. I downloaded all Matrix files from old gallery and uploaded for the new site. I cleaned template cache every time I changed something. I don't have any new idea!!!
The old site: www.lidioparente.fot.br/gallery2
The new site: www.marcelogargaglioneeluismaffei.com/gallery2
Darryl Morgan
Joined: 2005-11-10
Posts: 6
Posted: Thu, 2005-11-10 08:54
I've been searching the forums and so far I haven't found a workaround/patch/hack that fits my needs. So I think I'm going to take on what I've found from these various posts and make my own. Basically want the album thumbnail to open up the image at smallest resize. Smallest resize should be clickable (eg. a href) to the fullsize image but this is laoded up in another window. Also the drop down and the fullsize link should open up a new window. It'd be also nice to be able to have in this new window a dropdown that allows you to change the popup image size (eg. alla smugmug style).
mstookey
Joined: 2004-10-09
Posts: 4
Posted: Tue, 2005-11-29 18:08
hi,
any luck on this? would love to open large photo in popup.
If you go into the Album:Celica you see some thumbnails and if you click on a thumbnail, the image DON'T open in a new window ! Only if you click on this large image (which don't fit into my frame), a new Window will be opened !
...one Step too late... ;o)
The New Windows should appear if i click on the thumbnail ! how do i get that ?
markwaldhoff
Joined: 2006-01-26
Posts: 4
Posted: Fri, 2006-01-27 08:37
Ave wrote:
After a happy month with my galley showing popups I was asked to install another gallery with same features in another site. Same server, same PHP, same MySQL, of course. But I installed Gallery 2.0.1, the new version.
Not happens and javascript not appears with 'view source code'. I'm working with this for 7 days. I downloaded all Matrix files from old gallery and uploaded for the new site. I cleaned template cache every time I changed something. I don't have any new idea!!!
The old site: www.lidioparente.fot.br/gallery2
The new site: www.marcelogargaglioneeluismaffei.com/gallery2
I want it like you did in the old site ! That's fantastic !
What Version of Gallery was the Old one ???
I have Version 2.0.2 and i have the same problem, that javascript does not work (see posting above)...
MichielM
Joined: 2004-08-16
Posts: 15
Posted: Fri, 2006-02-24 23:15
Hi! I have the same problem, the javascript does not work anymore with 2.0.2...
I would also still like to have icons that allow you to navigate to the next/previous image.
MichielM
Joined: 2004-08-16
Posts: 15
Posted: Sun, 2006-02-26 17:44
Just found out that you can vote to get this feature: http://gallery.menalto.com/sfvote/all
The ID is 647528: [G2] Individual Images in Pop-up Window
lampster
Joined: 2006-11-16
Posts: 36
Posted: Wed, 2007-01-31 02:20
I'm using the Carbon template. The above doesn't seem to apply. Is there a solution for Carbon?
I've looked at the album.tpl and have attempted to change the following with "taget=blank"
Posts: 16504
See this thread, http://gallery.menalto.com/index.php?name=PNphpBB2&file=viewtopic&t=27255&highlight=open+window.
Only you'll be editing albumBody.tpl instead.
Posts: 10
I checked the thread and apparently they hadn't figured it out. Their goal was slightly different: to make a full sized image to appear as a popup, what i'm trying to do is simply click on thumbnail and opens the regular medium sized photo page in a new window this way people can view the thumbnails and picture at the same time, but in G2b4...i think the other guy had b1.
Posts: 16504
I've been talking to bharat on irc on how to do this. It's possible, but not efficient. He started down the path of getting me the answer, but we stopped when he suggested it might be easier to just edit photo.tpl to render only the image. Here's the useful stuff from our conversation:
That's when I started editing photo.tpl, theme.inc and creating a new "wrapper" for photo.tpl on my site. I'm lazy and didn't put in the extra 5 seconds of work to edit album.tpl to open the link in a new window. ;) Check out my site for an example: removed link, it doesn't contain modifications any longer those changes will be there for a couple of days or at least until I update from CVS again.
Here's what I did:
NOTE: You may want to create a new theme as at least one of your changes could be overwritten by an upgrade. Theme.inc cannot be made 'local', thus it's overwritten on every upgrade, if the theme exists in an upgrade.
1) created a 'local' directory under /themes/matrix/templates and copied photo.tpl into it. You'll want album.tpl as well
2) edited photo.tpl to look like this
3) created a new file imaginatively called 'none.tpl' in the same 'local' directory and copied the contents of theme.tpl into it. Then I cut out the stuff I didn't want, breadcrumb, the image at the top, the images at the bottom, etc
4) edited theme.inc and revised the showPhotoPage() function to return 'none.tpl' instead of 'theme.tpl'
That's pretty much it. You'll want to edit album.tpl to open the link in a new window and you may want to use javascript or what ever you want to open the new window. Gotta go the Closer is on ;)
Oh and maybe take a look at this, may or may not help: http://wpg2.ozgreg.com/viewtopic.php?t=46
Posts: 10
Hi, I followed your instructions to the last step...which again, is the final code for creating the new window. I'm sorry but I have no background in PHP or java or whatever the code is for album.tpl. So I went online and looked for new window scripts and tried pasting them but no luck....I also looked at the other link, but they hadn't figured it all the way out yet...and I also checked out your site and navigated all over the test pages, but did not find an example of an album thumbnail opening a new window. we're soo close, all I need is that five seconds you lazed out on! :D
www.xprecision.com
Posts: 13
hi all,
trying to do the popup-thing for the fullsize images. in gallery 1.x, if i remember right, there was a parameter in admin menu to select "popup yes/no". is this paramter gone in g2 beta4? how can i do this with g2 b4? the procedure must be different then above in some steps, i think
Posts: 13
self-solved ;)
change
<a href="{g->url arg1="view=core.ShowItem" arg2="itemId=`$child.id`"}">
to
<a {if $frameType != "itemFrame"}
href="{g->url arg1="view=core.ShowItem" arg2="itemId=`$child.id`"}">
{else}
href="{g->url arg1="view=core.DownloadItem" arg2="itemId=`$child.id`"}" target="_blank">
{/if}
Posts: 16504
That works if you're not showing image frames or want to show the original item (downloadItem). Either way, in my gallery I have full size images restricted to logged in users so I got an error if I wasn't logged in because I'm also using image frames...
All you really have to change is this:
<a href="{g->url arg1="view=core.ShowItem" arg2="itemId=`$child.id`"}">
to this:
<a href="{g->url arg1="view=core.ShowItem" arg2="itemId=`$child.id`"}" target="_blank">
Posts: 26
This is SWEET!! Is it possible to get it to work with RC2? Since the theme.inc system is gone, where would I modify theme.tpl to get it to return photo.tpl in a different template other than theme.tpl?
Posts: 16504
Theme.inc is there.
\themes\matrix\theme.inc
You'd modify theme.inc to refer the to a different template other than theme.tpl for photos. Re-read my previous post, http://gallery.menalto.com/index.php?name=PNphpBB2&file=viewtopic&p=157799#157799
Except my site doesn't have that modification in it any longer.
Posts: 26
WOW. I totally missed it (was looking in /templates!). Thanks so much for this mod. I've been trying to get something likes this working with G1 for quite some time. Now I'll try to throw some js in there for some nice sized popup windows! CHEERS
Posts: 26
I found a nice javascript that'll resize the window to the image and add some pixels for the nav and what not. The only problem is that it requires the dimensions of the image to set the size. I'm thinking it's in $photoItem-> somewhere but am clueless to pull it off. I know i have to set the width and hieght as variables and then call them in the js function.
How do I call the image dimensions and set them as variables?
Thanks Alot! With the javascript working properly I should be able to get my gallery to function somewhat like the "Photo of the Moment" at http://tumyeto.com/[/url]
Posts: 388
I'm using WPG2 plugin with latest G2 and Matrix theme. For my Full Size images to popup in a new window I simply added the below code to photo.tpl just above {* Download link for item in original format *}
This is actually the same exact code taken from the photo.tpl file in wordpress theme.
Posts: 26
Sweet! Is it possible to get that to link from the album view?
Posts: 16
I seem to be missing something... I had it set so that clicking on the resized image would result in the full sized image being opened in a new window back with beta4 and rc2, now it seems that no longer works, and I can't figure out what I did for the life of me. The above posters solution is alright if you want another link below the image, but I want the image itself to be the link. I figured I'd be editing photo.tpl, but now i'm not so sure. Anyone care to point me in the right direction?
Posts: 19
When I use <a href="{g->url arg1="view=core.ShowItem" arg2="itemId=`$child.id`"}" target="_blank"> I see subalbums in another window too. I want to see only photos in a new window.
Posts: 16504
kylemac123 and Ave take a look at step 4 above
http://gallery.menalto.com/node/31184#comment-123838
Posts: 19
I do all steps. But I need a popup when I click on a thumbPhoto. For a thumbAlbum (subAlbum) I don't want a popup.
Posts: 16504
You'll need to play around with adding this code to wrap around the part of the code that creates the link and brings in the image with this:
Posts: 19
Hi nivekiam,
It works. Many thanks for the help! Here is the code:
Now I' looking for a javascript. In order to show only the image.
Posts: 383
I haven't read this thread very very closely but I gather two suggested options for having a certain link open in a new window:
- <a href="javascr ipt:void(0);" onclick="wi ndow.ope n('somelink');">
- <a href="somelink" target="_blank">
I don't like either of these methods. Usualy I code using the strict dtd but I guss both methods are not correct to the XHTML dtd either (just guessing here). The first one is bad for obvious reasons; if javascript is impaired the script will not work and even worse; when users do click shift the link tries to go to "java script:voi d(0);" which is clearly wrong.
The second method I don't like because I think that that won't validate or otherwise the attribute was not intended for this use.
My solution involves the attribute rel="external".
Instead of adding target="_blank" add rel="external" to the link and make the following javascript functions available (through inclusion in the page header or by adding it to an existing (and included) .js file)
All you need to do then is to call the function fnAssignPopupLinks() at the end of the page and it runs in less then a second time for all browsers adding the onclick event handlers to all links having rel="external"
This way is much cleaner because it validates and does not disable a user from opening a link when javascript is switched off. And when users use the shift key the javascript lets the browser do the default action whatever that might be so it doesn't interfere with intuitive thingies...
Posts: 13
I have applied RwD's javascript (above) to my g2 and it is opening the images in a new window when I click the thumbnail.
***NB: I put the script in the header of templates/local/theme.tpl and surrounded the <script></script> tags with {literal}{/literal} tags to escape Smarty's attention.
Now i want the new window to be sized to the image, maybe a tad bigger to take navigation etc.
Any quick answers on how to pass the image dimensions to the script above and output a nice size window?
Thanks
Norv
*see next post
Posts: 13
I got a partial solution by adding this code to the header of theme_photo.tpl which is called in my theme.inc in function showPhotoPage.
(My theme_photo.tpl is a copy of theme.tpl with only the photo included on the page)
4 problems with this:
1. I would like to have a second popup automatically close the first popup
2. the album page blanks out for a second while the popup loads
3. when you stop the slideshow it goes to the popup of the current image and closes the album page
4. the margins vary and even disappear on some pix
Example at www.longforest.com/g2test/main.php
Thanks to http://www.sitepoint.com/article/resize-popup-fit-images-size for the code above.
Posts: 383
1, Assign a name to the window like window.open( strURL, 'myGallery' ).
2, ??.
3, That sucks, probably javascript related. Try to find the point where it does this by adding alert( 'message' ); statemants in the code. Naming the window might have solved this already though.
4, I think that depends on the image dimensions. Can you check that the images indeed do get a margin?? (check with firefox + some extentions)
______________________
I made a theme for G2, try it
Posts: 13
1. Thanks RwD, I will try that
2. I forgot to add that the function FitPic() in the header of theme_photo.tpl
is called in a <body onLoad='FitPic();'> tag, maybe that causes the album page visible beneath the popup to 'blank out' or reload?
3,4. ditto 1
Posts: 383
2, For some reason or the other IE seems to do blanking out stuff rather often when javascript is involved. If the problem doesn't happen in Firefox then it is probably just that...
______________________
I made a theme for G2, try it
Posts: 13
I assigned a name to the window in fnDOM1Open(event) as in
var oNewWindow = window.open( strURL, 'myPopup' ,'resize=yes,width=500,height=500');
and now
1. Fixed: the second popup closes the first popup
2. Fixed: the album page stays loaded
3. Not fixed yet - stopping slideshow still shows current image in popup and closes album page
4. Fixed: margins are fine
but
5. Now the second popup loads underneath the album page, despite the self.focus() line in function FitPic(), called when the popup loads
I have tried a lot of rudimentary hacks to get the new popup to focus, ie. load on top of the album page but ????
Here's the example again: http://www.longforest.com/g2test/main.php?g2_view=core.ShowItem&g2_itemId=17
Thanks again
norv
Posts: 383
3. Actually it is not closing the album page. The slideshow always stops at the current
picture and returns to the current pictures photo page. If your photo.tpl happens to be the page
opened in the popup, then the main window will look like the popup. You would have to change the
slideshow to go to the album rather then the picture:
(create the directory if needed)
So change it into:
or remove it completely.
Turn the link into:
It does what you ask, but I think this kind of makes it unclear where you are going to when you press
stop, perhaps you should also add the pagenumber? This will get worse when the slideshow also starts
opening subalbums (doesn't do that yet).
5. The problem is that the onload event fires after all page content has loaded (including images and
other binary content). I found a possible solution for this here.
One thing though here is that you do not have the correct dimensions yet before the image is loaded.
but you'll have that anyway if you get what you want. I am sure that gallery2 can return the image
dimensions with the page (php has these functions build in; you do not even require GD or something
like that...
______________________
I made a theme for G2, try it
Posts: 383
*accidentally pressed post comment*
Posts: 13
Thanks RwD, that Slideshow solution works well. I'll keep the sub-album issue in mind.
Currently working thru the possible solution to the onLoad problem.
How did you get a tiger-print rabbit? (Album in your G2 theme)
Posts: 383
norv,
There was a guy in the neighbourhood who had a tiger printed female. It wasn't sure
that her offspring would get them too because the father was a plain grey rabbit. But
some of them where the right color but blank, and some where grey. I bought a blank
one and the stripes appeared later on. Where they come from exactly I don't know.
Perhaps a rabbit came too close to a tiger on a sunny afternoon??
______________________
I made a theme for G2, try it
Posts: 13
lol..
I checked out the window.open page you mentioned and tried out a solution..
this is how my theme_photo.tpl looks now
and loaded.htc simply contains
but the behaviour is the same as before. Working on it.
Posts: 13
I've tried testing for focus as in
no matter where i put the alerts I can't seem to get focus anywhere.
Posts: 19
After a happy month with my galley showing popups I was asked to install another gallery with same features in another site. Same server, same PHP, same MySQL, of course. But I installed Gallery 2.0.1, the new version.
Not happens and javascript not appears with 'view source code'. I'm working with this for 7 days. I downloaded all Matrix files from old gallery and uploaded for the new site. I cleaned template cache every time I changed something. I don't have any new idea!!!
The old site: www.lidioparente.fot.br/gallery2
The new site: www.marcelogargaglioneeluismaffei.com/gallery2
Posts: 6
I've been searching the forums and so far I haven't found a workaround/patch/hack that fits my needs. So I think I'm going to take on what I've found from these various posts and make my own. Basically want the album thumbnail to open up the image at smallest resize. Smallest resize should be clickable (eg. a href) to the fullsize image but this is laoded up in another window. Also the drop down and the fullsize link should open up a new window. It'd be also nice to be able to have in this new window a dropdown that allows you to change the popup image size (eg. alla smugmug style).
Posts: 4
hi,
any luck on this? would love to open large photo in popup.
Posts: 16504
Any particular reason why this doesn't work http://gallery.menalto.com/node/31184#comment-123929
____________________________________________
Like Gallery? Like the support? Donate now!!! See G2 live here
Posts: 4
I tried this, but it doesn't work for me...
please take a look at my site:
http://www.toyotayaris.de/cmsmadesimple/index.php?page=Gallerie2
If you go into the Album:Celica you see some thumbnails and if you click on a thumbnail, the image DON'T open in a new window ! Only if you click on this large image (which don't fit into my frame), a new Window will be opened !
...one Step too late... ;o)
The New Windows should appear if i click on the thumbnail ! how do i get that ?
Posts: 4
I want it like you did in the old site ! That's fantastic !
What Version of Gallery was the Old one ???
I have Version 2.0.2 and i have the same problem, that javascript does not work (see posting above)...
Posts: 15
Hi! I have the same problem, the javascript does not work anymore with 2.0.2...
I would also still like to have icons that allow you to navigate to the next/previous image.
Posts: 15
Just found out that you can vote to get this feature:
http://gallery.menalto.com/sfvote/all
The ID is 647528: [G2] Individual Images in Pop-up Window
Posts: 36
I'm using the Carbon template. The above doesn't seem to apply. Is there a solution for Carbon?
I've looked at the album.tpl and have attempted to change the following with "taget=blank"
<div>
{if isset($theme.params.$frameType) && isset($child.thumbnail)}
{g->container type="imageframe.ImageFrame" frame=$theme.params.$frameType
width=$child.thumbnail.width height=$child.thumbnail.height}
<a href="{g->url arg1="view=core.ShowItem" arg2="itemId=`$child.id`"}">
{g->image id="%ID%" item=$child image=$child.thumbnail class="%CLASS% giThumbnail"}
</a>
{/g->container}
{elseif isset($child.thumbnail)}
<a href="{g->url arg1="view=core.ShowItem" arg2="itemId=`$child.id`"}" target="blank">
{g->image item=$child image=$child.thumbnail class="giThumbnail"}
</a>
{else}
<a href="{g->url arg1="view=core.ShowItem" arg2="itemId=`$child.id`"}" class="giMissingThumbnail" target="blank">
{g->text text="no thumbnail"}
</a>
{/if}
</div>
Gallery version = 2.1.2 core 1.1.0.2
PHP version = 4.4.4 cgi
Webserver = Apache/1.3.37 (Unix) mod_fastcgi/2.4.2 mod_auth_passthrough/1.8 mod_log_bytes/1.2 mod_bwlimited/1.4 FrontPage/5.0.2.2635.SR1.2 mod_ssl/2.8.28 Ope