[Working] Full size popup for G1.5
Surfdude_nl
Joined: 2005-04-25
Posts: 8 |
![]() |
Hi, I was looking over the forum and I found the pop-up sollution for 1.4.3, but that didn't work for me so I started editing the files. Now I got it working for V1.5. It is a first version and I'm not sure if everything is good and nicely done. But all you gallery guru's out here will point me out on that! I just hope I can help some people here a bit further. Before we start backup the files you change ! Here we go than. I hope it will be clear for most of you and that I still now how I did it ;) In util.php find function pop_image($url, $url_is_complete=0) { global $gallery, $index; /* Separate the target from the arguments */ list($target, $arglist) = split("\?", $url); /* Split the arguments into an associative array */ $tmpargs = split("&", $arglist); foreach ($tmpargs as $arg) { if (!$arg) { continue; } list($key, $val) = split("\=", $arg); $args[$key] = $val; } if (!$url_is_complete) { $url = makeGalleryUrl($target, $args); $url = "\"$url\""; } $photo = $gallery->album->getPhoto($index); $image = $photo->image; list($iWidth, $iHeight) = $image->getRawDimensions(); // maybee I should add the album name w/o spaces to winName // solution for now is simply add time to name of window $winName = time() . $index; $winName = str_replace(" ", "", $winName); return popup_js($url, $winName, "height=" . $iHeight . ",width=" . $iWidth .",location=no,scrollbars=no,menubars=no,toolbars=no,resizable=no"); } ************** ************** <?php /* 2/01/2003 New file for popup window */ // Hack prevention. if (!empty($HTTP_GET_VARS["GALLERY_BASEDIR"]) || !empty($HTTP_POST_VARS["GALLERY_BASEDIR"]) || !empty($HTTP_COOKIE_VARS["GALLERY_BASEDIR"])) { print _("Security violation") ."\n"; exit; } $temp=$index_id; require(dirname(__FILE__) . '/init.php'); // Hack check if (!$gallery->user->canReadAlbum($gallery->album) && (!$gallery->user->canViewFullImages($gallery->album))) { return; } ?> <html> <head> <?php $index=$temp; $photo=$gallery->album->getphoto($index); $image = $photo->image; $photoURL = $gallery->album->getAlbumDirURL("full") . "/" . $image->name . "." . $image->type; //echo "<title>" . $gallery->album->getCaption($index) . "</title>"; echo "</head>"; echo "<body background=\"" . $photoURL . "\">"; ?> </body> </html> ************** Quote:
Error: Requested index [0] out of bounds [55] In view_popimage.php, try changing I (fryfrog) found this info here. Briefly, it is due to a change in the way php works. Previously, if you passed a variable using the "?variable=value" method, you could access it in the php page using "$variable" but in newer versions of php this was changed for various reasons to "$_GET["variable"]". I would bet the "new" way also works for slightly older version *and* there is supposidly a way to alter your php.ini to keep using the old way (but that could present security issues). I hope it works for you to and that I didn't forget anything with my sleepy head. It works fine for me. Thanks to RustedNail, PixelPoet and Dave for the fix that made it a lot easyer to make this. 8) Have a good night I'm going for a sleep! Bye! *edit: I (fryfrog) fixed a few very minor typos. viewphoto.php should be view_photo.php and there was a double of some instructions. Nothing major. I also fixed the out of bounds errors and edited your post. I added a little info about turning the scroll bars on and making the popup an <img> instead of <body background>. |
|
safetybar
Joined: 2005-04-28
Posts: 8 |
![]() |
Everything is great, however my full size image doesnt open in a new window. It goes from thumbnail to full size (great) but in the same window. |
|
HecticDMC
Joined: 2005-04-28
Posts: 1 |
![]() |
Gallery 1.5 I'm having trouble as well... when I access my Gallery directly, all is well, although I can't seem to turn on scrollbars. When I access it from inside my PostNuke site though, I get the following 404: The requested URL /hs/"modules.php was not found on this server. It's interesting, it's trying to put a double-quote in the url... but it doesn't do that when I load up gallery on it's own, outside of PostNuke. Also, I tried changing scrollbars=no to scrollbars=yes in util.php but it had no effect. I hard coded the window dimensions because I want to limit the window size, and set it to resize, but those srollbars aren't cooperating. This is the line as I have it now: return popup_js($url, $winName, "height=600,width=800,location=no,scrollbars=yes,menubars=no,toolbars=no,resizable=yes"); Any ideas? http://www.hecticstudios.com/hs/modules/gallery - direct to my gallery |
|
safetybar
Joined: 2005-04-28
Posts: 8 |
![]() |
anyone have any ideas? |
|
mtlfever
Joined: 2005-04-29
Posts: 10 |
![]() |
I tried to do that. The problem is that when the popup appears, I only see a message saying : Quote:
Error: Requested index [0] out of bounds [55] I don't know what this means but its not good for sure hehe Can someone help ? Thanx a lot Alex |
|
Surfdude_nl
Joined: 2005-04-25
Posts: 8 |
![]() |
mtlfever wrote:
I tried to do that. The problem is that when the popup appears, I only see a message saying : The error means that the picture ID isn't getting true... Your sure your gallery is 1.5? And that you followed all the above steps? If thats so can you put the next line at the top of view_popimage.php: <?php print "picture id=" . $index_id; ?> This will print a the picture id on the pop-up screen (and 2 header warnings/errors, ignore them). Can you post here what you see on your pop-up. |
|
Surfdude_nl
Joined: 2005-04-25
Posts: 8 |
![]() |
HecticDMC: Than replace the code in view_popimage.php for this: <?php /* 2/01/2003 New file for popup window */ // Hack prevention. if (!empty($HTTP_GET_VARS["GALLERY_BASEDIR"]) || !empty($HTTP_POST_VARS["GALLERY_BASEDIR"]) || !empty($HTTP_COOKIE_VARS["GALLERY_BASEDIR"])) { print _("Security violation") ."\n"; exit; } $temp=$index_id; require(dirname(__FILE__) . '/init.php'); // Hack check if (!$gallery->user->canReadAlbum($gallery->album) && (!$gallery->user->canViewFullImages($gallery->album))) { return; } ?> <html> <head> <?php $index=$temp; $photo=$gallery->album->getphoto($index); $image = $photo->image; $photoURL = $gallery->album->getAlbumDirURL("full") . "/" . $image->name . "." . $image->type; //echo "<title>" . $gallery->album->getCaption($index) . "</title>"; echo "</head>"; echo "<img src=\"". $photoURL . "\">"; ?> </body> </html> The scroll didn't work because the image was loaded as a background. This will fix that problem. I don't work with Postnuke so can't help you with that. safetybar: Goodluck, |
|
mtlfever
Joined: 2005-04-29
Posts: 10 |
![]() |
Here is the error message I get when I insert the line you ask me to put : Quote:
picture id= Do you know how to fix that ? Thank you. |
|
Surfdude_nl
Joined: 2005-04-25
Posts: 8 |
![]() |
All right, thats not good. Lets see... Your sure you have gallery 1.5? Did you do this part? Quote:
************** If you did that... Let's do the next thing. Can u put location on yes in util.php. And that post here what the addressbar in the pop-up windows says. |
|
mtlfever
Joined: 2005-04-29
Posts: 10 |
![]() |
I am sure I have version 1.5 and that I dit the steps two times. When I put the location "on" I get : And still the error message : Quote:
picture id= |
|
safetybar
Joined: 2005-04-28
Posts: 8 |
![]() |
I still can't even get the pop up. |
|
mtlfever
Joined: 2005-04-29
Posts: 10 |
![]() |
Anyone as a solution ??????? |
|
m7k
Joined: 2005-05-04
Posts: 7 |
![]() |
I followed the instructions given by Surfdude_nl and ended up with similar problem to that of mtlfever. The popup opens as an empty page with the following error: Quote:
Error: Requested index [0] out of bounds [1] I then included the following in the viewpop Quote:
and got this message: Quote:
picture id= Error: Requested index [0] out of bounds [1] Does anyone have any ideas on how to fix this?? I am running running 1.5 and I think I did everything as Surfdude_nl wrote. |
|
mtlfever
Joined: 2005-04-29
Posts: 10 |
![]() |
So what's happening with that ? Is there a solution ? Surfdude_nl ? Floridave ? Anyone ???? :S !?!? Alex |
|
safetybar
Joined: 2005-04-28
Posts: 8 |
![]() |
Yeah, I'm stuck with a broken gallery |
|
khsjr1970
Joined: 2004-04-24
Posts: 271 |
![]() |
your gallery is broke ? if so go back to the files you backed up this should put your gallery back in working order. you did back them up didnt you? if not redownload gallery, and re-up the files that you changed in this post. This will at least "fix" your broken gallery. |
|
Surfdude_nl
Joined: 2005-04-25
Posts: 8 |
![]() |
mtlfever wrote:
I am sure I have version 1.5 and that I dit the steps two times. ` Sorry for my late reaction. I wasn't near a computer for a week. That feels pretty good ;) Lets see... The strange thing is that the variable (index_id) is put in the address but view_popimage.php can't read it. Thats very strange because it works for me. Maybe this is a PHP setting? Somebody knows? I have no idea what else it can be... |
|
safetybar
Joined: 2005-04-28
Posts: 8 |
![]() |
Well it's not that it's broken...i'm still trying to have it so when you click on a thumbnail .. a sized new window opens with the picture....still no luck. |
|
khsjr1970
Joined: 2004-04-24
Posts: 271 |
![]() |
With XP and pop up blockers of the day, I have only ever found this desired feature to be an annoyance rather then a benefit, but i wish you guys the best of luck with it. |
|
mtlfever
Joined: 2005-04-29
Posts: 10 |
![]() |
Please guys ! Help me ! I need that ! Alex |
|
sswiger
Joined: 2005-05-13
Posts: 6 |
![]() |
On my site (http://web.ctsionline.com/~railyard/), Any ideas on what's causing this? I'm really hoping to use the pop-up solution in Gall v1.5 because my layout only allows for a 400px wide intermediate image. thanks, |
|
sswiger
Joined: 2005-05-13
Posts: 6 |
![]() |
follow-up: Anyone else have this issue? thanks, |
|
DerOlum
Joined: 2004-06-14
Posts: 6 |
![]() |
... the same here. oliver |
|
fryfrog
Joined: 2002-10-30
Posts: 3236 |
![]() |
I just started poking around with this and am getting the same error that many others are. The index out of bounds thing. I went and put some debug code EVERYWHERE, and everything is fine except for the view_popimage.php. For some reason, even though the page is loaded with "?index_id=XX" the page can't use index_id. |
|
fryfrog
Joined: 2002-10-30
Posts: 3236 |
![]() |
Fixed! The problem stems from a change in the way PHP handles GET/POST variables. Or something. I found out about it here In view_popimage.php, change You can see it working on my gallery by clicking on the sized image here. |
|
safetybar
Joined: 2005-04-28
Posts: 8 |
![]() |
Getting closer! With that new fix I'm able to get the pop -up, however I'm still looking to go directly from Thumbnail to pop-up....does anyone have any ideas? Thanks! |
|
fryfrog
Joined: 2002-10-30
Posts: 3236 |
![]() |
safetybar, you will need to look into making the same sort of changes in view_albums.php instead of view_photo.php. You'll have to figure out a way to make it pop up for images and not albums though. Also, if you want to be able to click the pop up and get ANOTHER popup for the full size... you'll have to do more work. |
|
safetybar
Joined: 2005-04-28
Posts: 8 |
![]() |
Hmm, thanks for your help. I looked at the Album file and can't find anything. I'm trying the same thing with Coppermine right now and am at the same point with no way to go directly to the popup. |
|
giorgos
![]()
Joined: 2002-08-19
Posts: 115 |
![]() |
I followed the instructions but when I click on the intermediate image to see the full image I Get : "You don't have permission to access /"modules.php on this server" I run gallery as a postnuke module. Any ideas? Thanks |
|
floridave
![]()
Joined: 2003-12-22
Posts: 27300 |
![]() |
add modules.php to your safe to include list in index.php |
|
giorgos
![]()
Joined: 2002-08-19
Posts: 115 |
![]() |
Dave, I add modules.php to the safe to include list in index.php but still getting : Forbidden Giorgos |
|
floridave
![]()
Joined: 2003-12-22
Posts: 27300 |
![]() |
URL? Sorry don't do *nuke. |
|
giorgos
![]()
Joined: 2002-08-19
Posts: 115 |
![]() |
Dave Is not working either. http://www.dailyalbum.com/"modules.php?index_id=4&op=modload&name=Gallery&file=index&include=view_popimage.php" Anyway thanks for your help. I 'll keep searching. Maybe I'll post it at the *nuke forum. Giorgos |
|
fryfrog
Joined: 2002-10-30
Posts: 3236 |
![]() |
So what is throwing in the " " that don't look like they belong? |
|
giorgos
![]()
Joined: 2002-08-19
Posts: 115 |
![]() |
This url is poping up and then redirects to a 403 error. For one or another way the code in util.php is generating a url with quotes which is rejected. |
|
PnL
Joined: 2005-03-21
Posts: 25 |
![]() |
I've tried to add this to my new gallery 1.5 but I get the following errors in the new window: Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /home/virtual/site75/fst/var/www/html/gallery/view_popimage.php on line 2 Parse error: parse error, unexpected T_STRING in /home/virtual/site75/fst/var/www/html/gallery/view_popimage.php on line 2 I have little experience coding php but am learning - what does these errors mean? Thanks, |
|
fryfrog
Joined: 2002-10-30
Posts: 3236 |
![]() |
How bout a link to your site so we can see the error? Does that file have anything about debug in it btw? Its been a while since I looked. |
|
PnL
Joined: 2005-03-21
Posts: 25 |
![]() |
Here's the URL to the gallery: http://www.pnladventures.com/gallery/ We're just setting it up so not all the albums have pictures in them. The new window opens but it displays those two error messages. The view_popimage.php doesn't have anything in it with the code 'debug' - not sure if that is what you meant. What is the link supposed to the new window supposed to be? I get the file name (no extension) with a "#" symbol after the image name. Not sure if this is the way it is supposed to be or not. Sorry for being just a newbie |
|
subnet_rx
Joined: 2004-09-20
Posts: 20 |
![]() |
I'm getting the same "safe_to_include" problem with my Mambo/Gallery integration. I have added it to the array list, but still get: Security error! The file you tried to include is not on the approved file list. To include this file you must edit Gallery's index.php and add view_popimage.php\" to the $safe_to_include array That backslash and quotes looks like the file url is setup wrong to me. |
|
subnet_rx
Joined: 2004-09-20
Posts: 20 |
![]() |
Got it working, there were some extra quotes in the util.php function. It doesn't pop up as just a picture in the Mambo/G1 integration though, it's still a part of the template. |
|
PnL
Joined: 2005-03-21
Posts: 25 |
![]() |
Care to give more details? I'm still having the same problem as I posted above. I'm hoping that someone can lead me in the right direction ... anyone? Thanks |
|
Pachenko
Joined: 2005-08-20
Posts: 1 |
![]() |
Bump Anybody have this fix for Postnuke? |
|
Nahoo
![]()
Joined: 2005-08-22
Posts: 6 |
![]() |
This image link does the business in the view_photo.php page:
I still cannot get the full image to appear without the Mambo theme. Anyone know how to make just the HTML in view_popimage.php come into view? |
|
Nahoo
![]()
Joined: 2005-08-22
Posts: 6 |
![]() |
In the meantime, I have found a very quick solution to all the integration problems with Mambo, PHP Nuke and the rest... Edit: util.php Nothing required Create: view_popimage.php <?php if (!empty($HTTP_GET_VARS["GALLERY_BASEDIR"]) || !empty($HTTP_POST_VARS["GALLERY_BASEDIR"]) || !empty($HTTP_COOKIE_VARS["GALLERY_BASEDIR"])) { print _("Security violation") ."\n"; exit; } require_once(dirname(__FILE__) . '/init.php'); $index = $_GET['index_id']; // Hack check if (!$gallery->user->canReadAlbum($gallery->album) && (!$gallery->user->canViewFullImages($gallery->album))) { return; } $photo=$gallery->album->getphoto($index); $image = $photo->image; $photoURL = $gallery->album->getAlbumDirURL("full") . "/" . $image->name . "." . $image->type; echo '<html> <head> <title>'.$gallery->album->getCaption($index).'</title> </head> <body style="margin: 0"> <a href="javascript:void(0)" onClick="window.close()"><img src="'. $photoURL.'" border="0" alt="Close photo"></a> </body> </html>'; ?> Finally on the view_photo.php page, you will need to comment out or replace this:
...with this: $view_popimage_location = $gallery->app->photoAlbumURL."/view_popimage.php"; $scrollbars = "no"; $resizable = "yes"; $href= 'javascript:void(0);" onClick="window.open(\''.$view_popimage_location.'?index_id='.$index.'&option=com_gallery&Itemid='.$image.'&include=view_popimage.php\',\''.time().'\',\'height='.$imageHeight.',width='.$imageWidth.',location=no,scrollbars='.$scrollbars.',menubars=no,toolbars=no,resizable='.$resizable.'\'); window.opener=self; return false;'; Clearly, you may wish to change some of the window preferences here. Not bad for post #2? |
|
mrf00rk
![]()
Joined: 2005-06-02
Posts: 158 |
![]() |
Can someone post the whole edit to to? Instead of bits and pieces here and there? I would be very gratefull. -Andreas |
|
Mizzy
Joined: 2005-08-26
Posts: 5 |
![]() |
Hi Guys, This is exacly what I am looking for but I am having a problem. i followed the instructions as best I could but I got his error when i went to view my gallery: Parse error: parse error, unexpected T_STRING in /home/genki42/public_html/graciebarracalgary/gallery/util.php on line 28 I am using gallery 1.5 with mambo 4.5.3 in a seperate database but as a component. Could anyone help me out here? Mizzy |
|
Mizzy
Joined: 2005-08-26
Posts: 5 |
![]() |
Anyone have any ideas Cheers |
|
hodgson
Joined: 2005-09-07
Posts: 3 |
![]() |
For those of us who are using Gallery 1.5 and NOT embedding it inside a CMS of some kind (like wordpress), This code works, but instead of changing this line: makeAlbumUrl($gallery->session->albumName, $id, array("full" => 1)); You need to change, instead, this line:
to:
in view_photo.php. I have embedded my gallery inside MT and big images broke my site. THis worked for me, however. |
|
hodgson
Joined: 2005-09-07
Posts: 3 |
![]() |
Mizzy wrote:
Hi Guys, This means there's a syntax error on line 28. You are probably missing a quote or a semicolon or something. |
|
blitzburgh
![]()
Joined: 2005-09-03
Posts: 17 |
![]() |
mrf00rk wrote:
Can someone post the whole edit to to? Instead of bits and pieces here and there? I would be very gratefull. I agree, this is something I've been looking to do since I installed Gallery. But am afraid to try this because of the edits here and fixes there. Then a fix for the fix, etc. It's cool to have that feature, but is there a fully working edit for this yet? (in one post please :wink: ) |
|
blitzburgh
![]()
Joined: 2005-09-03
Posts: 17 |
![]() |
Well, I crossed my fingers and tackled this. I got it to work, but not how I'd like. I think this was mentioned here somewhere, but what I'd like it to do is go from ALBUM ONE'S, ALBUM TWO'S, etc., thumbs directly to the pop-up. The way it works now.. clicking the thumb takes you to the page that gives you the choices (normal or full), if on normal and you click the pic, it opens the pop-up. If it's on full, it's not clickable. So, basically.. eliminating that page (view_photo.php) and applying the pop-up to view_album.php. I'm assuming you cannot edit the view_album.php exactly like the view_photo.php, or am I wrong? |
|