***1.4.3-pl1 Popup instructions, yes 1.4.3-pl1***
RustedNail
Joined: 2004-05-19
Posts: 10 |
Posted: Thu, 2004-05-20 21:58 |
Yea finaly we can stop having 50 million posts asking for a popup for 1.4.3 First let me say BACKUP YOUR FILES I am not responsible for anything that goes wrong. With that out of the way lets get started. PixelPoet's popup instructions work to some degree, but I wanted on that would auto resize the window. So I came up with this one. ************** 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"); } ************** $adminCommands .= _('normal') . "&_nbsp;|&_nbsp;<a href=\"$link\">" . _('full') .'</a>&_nbsp;]'; } else { $adminCommands .= "<a href=\"$link\">" . _("normal") .'</a>&_nbsp;|&_nbsp;'. _('full') .'&_nbsp;]'; ************** $adminCommands .= _('normal') . "&_nbsp;|&_nbsp;<a href=\"$current_url\" onClick=\"'. pop_image(\"view_pimage.php?index=\" . $index).';\">" . _('full') .'</a>&_nbsp;]'; } else { $adminCommands .= "<a href=\"$current_url\" onClick=\"'. pop_image(\"view_popimage.php?index=\" . $index).';\">" . _("normal") .'</a>&_nbsp;|&_nbsp;'. _('full') .'&_nbsp;]'; ************** if (!empty($href) ) { $href_tag= "<a href=\"$href\">$tag</a>"; } else { $href_tag=$tag; } ************** if (!isset($full)) { if (!empty($href) ) { $href_tag= "<a href=\"$href\">$tag</a>"; } else { $href_tag=$tag; } }else{ if (!empty($href) ) { $href_tag= "<a href=\"$href\">$tag</a>"; } else { $href_tag= '#" onClick='.pop_image("view_popimage.php?index=" . $index).';return false'; } } ************** <?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; } require(dirname(__FILE__) . '/init.php'); // Hack check if (!$gallery->user->canReadAlbum($gallery->album) && (!$gallery->user->canViewFullImages($gallery->album))) { return; } ?> <html> <head> <?php $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>
I hope this helps it works great in mine. Let me know what you think. |
|
Posts: 20
I'm hoping you left a step out, because it just doesn't work in gallery 1.4.3. I know you have it going on a slightly later version but I thought I would give it a try. Sorry to say it didn't quite acheve the same result. My just results in a blanck window with the proper name but no picture what so ever. I would love to get this working, so if you , or pixel poet have any ideas, I would love to hear about them.
I was wondering, is the view_pimage.php below correct, or is it supposed to be view_popimage.php? I changed it and it didn't have any effect.
I was also wondering if I already have a background immage set, does this still work? Feel free to check it out at [url]www.bengm.com/gallery[/url]. It's just a test site and random pics but you will get the idea.
Any Ideas?
Posts: 27300
RustedNail, Great job!
A few things that I can change on the above post if RustedNail does not do it. In the new file view_popimage.php remove some carriage returns: (whitespace) also to remove the css call
I think there should be a double check to see if the user has permissions to view the full sized images:
View_photo.php does the check already but there is way to prevent somebody from just typing in a URL.
And I should also mention that the forum does not like html spaces: &_nbsp; without the underscore. So when posting code that has html spaces use a underscore and tell the reader to remove the underscore.
Dave
PS if the code above gets changed then I can remove my post to prevent the thread from getting long and difficult to read.
Posts: 20
I can't seem to get it to work. I just get a blank window that looks like it could be the right size but it has my default background on it and not the picture.
Would love some help with this. Do you think I have to upgrade?
Ben
Posts: 10
When you goto your gallery and click a picture in the album to view does it show a javascript error on the bottom left of the browser. Try going to the properties of the album and find this
Offer visitors ability to specify preference for full-size or resized images
put it to no and it should work. I just checked mine and it did the same thing it would not work if I gave the user the option to view resized or full. but with the option off it works great.
floridave thanks for the help, I changed the post above to reflect what you changed.
Posts: 27300
beniam,
In your view_popimage.php you are calling a style sheet. Try RustedNail's new code above and you shoule be good to go.
Dave
Posts: 10
yea remake the popimage.php file with the new code above you popup is using the css and is putting in a background and your image is not showing up
Posts: 20
It seems I am making progress! I got the full sized immage to show up in a new window but one problem remains. I get this:
It is displayed in the upper left side of the page over the immage. Any ideas? It is almost perfect...
Thanks again for the help!
Ben
Posts: 20
Anyone have any ideas? I re-did eveything and I'm still getting those warnings. I would really love it if someone could bail me out. You can check out my tiny little gallery at [url]www.bengm.com/gallery[/url].
Thanks.
Ben
Posts: 27300
beniam,
Try the steps over agian with your backup (you did a backup right?) You can get a error like that if util.php has a extra space or carriage returns. At the end is a common mistake. I suspect your util.php since the popup prtion works.
Dave
Posts: 20
I got it working!
It was infact the carriage returns. I had went throught the util.php and got rid of them, but it didn't do anything. I then went throught the view_popimage.php and got rid of them there and that solved it!
Thanks for sticking with me floridave! And thanks to RustedNail for doing the heavy lifting. I'm so excited to report that the hack works perfectly now.
Ben
Posts: 1301
Hurray! Now maybe I'll stop getting email asking when I'll fix the code I wrote for the earlier version! (cuz I hadn't looked at it since I wrote the original instructions, to be totally honest...)
Thanks, RustedNail - you've made millions (okay, so maybe just hundreds) of people happy! :D :wink:
Gaile
Posts: 13
RustedNail (or anyone), do you have a site where i can see the finished product of these mods?
Posts: 27300
TheMartian,
Not my site but beniam's. It is implemented:
http://www.bengm.com/pictures/
Dave
Posts: 10
I have it on my site but I don't use it I made it for everyone else that wants popups.
Posts: 13
cool... do you think that there is an easy way to change this code to make the thumbnails open a new window... then have a mid sized version of the pic in a new window then the user could click that and see the full sized version in the same window?
Posts: 13
...bump... ...anyone?
Posts: 18
Im getting a script error when I run this hack. It refers to this line:
<td class="admin" align="right" valign="middle" width="3000" height="18">&<span class="admin">&Vis bilder:&[&normal&|&<a href="" onClick="'. pop_image("view_pimage.php?index=" . 3).';">full</a>&]<br></span>&</td>
Any ideas?
http://galleri.automotor.no/valerbanen_210504-230504/DSCF0440
Posts: 10
Try going to the properties of the album and find this
Offer visitors ability to specify preference for full-size or resized images
put it to no and it should work. I just checked mine and it did the same thing it would not work if I gave the user the option to view resized or full. but with the option off it works great
If your using popups why do you give the user the option of view normal or full this saves you bandwidth.
Posts: 1301
My turn for a question - I have this working on v1.4.3 pl2 except for the following message which shows up in the popup in Opera:
Line 141 - 143:
Ideas on how to fix this?
Thanks,
Gaile
Posts: 1301
Here I am what I said I wouldn't do ... bumping this topic up.
I have another question too - how hard would it be to put the link to the popup under the intermediate image instead of having that image clickable? (lazy me, I know...) :P
Gaile
Posts: 27300
PixelPoet,
Nice to know that the 'teacher' needs help once in a while.
You can add a link under the image in view_photo by renaming this to /html_wrap/inline_photo.frame
There is 2 echo statements at the bottom that you can remove the one that you don't like.
One uses JavaScript popup window - you can add window properties to it like the size, toolbar etc.
The second uses the link to the new pop_image file.
Edit the names of the links to your desires.
Remove the one you don't want.
Dave
Posts: 1301
So Dave... :lol:
How 'bout that eh? :wink: (actually, the more features that get added the more code there is to wade thru, so help is good)!
As I mentioned in my PM... (check your mail) - a thousand thanks to you! It is very much appreciated.
Gaile
Posts: 1
All, I have tried to tweak my install this morning -- unfortunately I have version 1.4.4 RC1 and I can't get it to work... I'm not too familiar with php and am not able to figure out myself if the problem has been caused by the version or a type somewhere.
This is the error when clicking on the intermediate image: "Parse error: parse error, unexpected $ in /xxx/xxx/www/plmtest/gallery/view_photo.php on line 732" Line 732 is the last line of the file.
Thanks for your help!
Sander.
Posts: 6
First thanks to Floridave for pointing me to this thread. And Rustednail for the hack.
If you want to add a click-then-close function to the popup, put this in the view_popimage.php instead:
But if you already made changes and don't want to replace anything, all you have to do is add this into your <body> tag:
leftmargin=\"0\" topmargin=\"0\" marginheight=\"0\" marginwidth=\"0\" onBlur=\"self.close()\" onClick=\"self.close()\"
One question I still have, how can I get it so that clicking a thumbnail brings the popup?
Posts: 6
Also, after I installed this, the [print this photo with "select service"] pulldown shows up even when I disabled it. That goes for click counts as well.
Posts: 6
This is regarding the thumbnail -> popup. I'm getting close.
In view_album.php I replaced
with
But I get this message
Line 56 is regarding the width and height needed to for the javascript popup code. Can anyone help me out here? Much thanks.
Posts: 6
ok news flash, I did it! It feels like a real quick and dirty hack and there might be chances where the full picture might repeat in the popup (if the image is real small, say 50x50 pixels). If anyone has fixes to add, please do.
in view_album.php find:
require(dirname(__FILE__) . '/init.php');
under it, add:
require_once('util.php');
still in view_album.php find:
$gallery->html_wrap['imageHref'] = makeAlbumUrl($gallery->session->albumName, $id);
replace with:
That is it! So simple but hard to figure out (for me anyways). This type of setup is very useful for a minimalistic style, or for portfolios (which is why I went through the trouble figuring this out). Hope you guys find this useful.
Posts: 120
Question:
I am using gallery embedded into postnuke.
If I click on an image the browser will load the following URL:
w?w.carsten-volmer.de/"modules.php?index=1&op=modload&name=gallery&file=index&include=view_popimage.php"
Take a look at the " (i don't know the english name for it)
I included the "view_popimage" file in my index.php
So If I manually enter the following URL without the " everything is fine.
w?w.carsten-volmer.de/modules.php?index=1&op=modload&name=gallery&file=index&include=view_popimage.php
Any idea? Thanks?
My inline_imagewrap.inc changes (from the first post in this thread):
Posts: 120
Oops. I thought that it was a smaller problem to get rid of the " sign. ;-)
Anyone there, who can help me?
Posts: 26
Is there a coder out there?
Is it difficult to change the code.
I am using gallery embedded in postnuke, too. And I get the same URL-problem.
Posts: 120
Simple remark or delete this entry:
No more changes neccesary
Posts: 7
This popup mod. is great! This was just what I needed, almost......
What if the popup image is larger than the screen size? On Mozilla, Safari, Konquerer, and IE the popup has no scroll bars! Is there a simple fix?
Thanks in advance.
Posts: 7
Here's how to fix not being able to scroll images in the popup window (solved my own question):
Apparently using "<body background=....> doesn't allow scrolling (because the background is tiled if necessary?). The solution is use "<body><img src=...>".
In view_popimage.php, change:
to:
Then, in util.php, you can set the scrollbars=yes toward the bottom of the pop_image function.
See http://www.jimwuerstlin.com for a working example (though only a few images on this test site are large enough to even have pop-ups after the intermediate size image).
Marcus
Posts: 5
hey guys
im running Gallery v1.4.4-pl2 and i've tried to edit the files like the tutorial said. when i click on the image to get a full view i get a popup window the size of the image, but i get and error page "page can not be found"
any ideas? it seems to be half working
thanks
Posts: 5
i have the same problem like jin410!
any ideas?!
Posts: 2
Ok, I have it working, but need help. Since the link is href="#", when you click on a photo and the larger image pops up the album page refreshes and goes back to the top. How can I easily remove the href="#" or have the album page not refresh at all? I tried and for the life of me I can't get it to where I want it.
Site in question: http://www.kathymccarthy.com/portfolio/fashion
Posts: 2
Would also like to add a title tag (such as "Click to Enlarge") to the thumbnail image.
Can any one assist for the problem in the above post and for this one?
Posts: 1
Hello,
I got the popup window to work in a standalone gallery. And the popup windows shows the proper url address when opened such as below,
But when gallery is embeded under mambo, popup window takes me to address as below,
I've tried everything posted in the forums, and tried fixing some things myself, but could not reach a solution.
I figure I have to tweak the coding so that popup window gets redirected to the proper url address, but this is over my head.
I would much appreciate some help.
Thanks
Posts: 271
anyone with this working in 1.4.4 pl4 ?
Posts: 10
yes i have it working with PHP nuke save the file on the link below and replace your existing ones.
you will also need to edit your index.php file to include
"view_popimage.php",
Chet
Dont forget to backup your originals
:-?
http://www.vicpics.com/gallery1_4_4popupfiles.zip
Edit: Fixed broken link
Posts: 271
I am not using nuke, I am using the standalone. therefore are, the files you are giving me, still usable ?
Posts: 10
yes they are original gallery files from 1.4.4
show me your site when you get it done...
Take care
Chet
just give me a shout if you have any problems
Posts: 271
Posts: 10
go to your index.php file around line 102 you will see a list like this
just add it to that list
Chet
Posts: 271
Thanks for that reply, I think you missed my second question.
its calling view_popimage.php, this file is not included in your files that are zipped. I take it that I should be getting this from somewhere elese earlier in the thread ?
Thanks for your help with this. I really appreciate it.
Posts: 10
sorry i missed that
just copy and paste this into your editor and save it as view_popimage.php
then place it in your main gallery directory
yes long day and i am kind of slow sometimes :-?
Posts: 271
ok, thanks for the education.
Unfortunately it doesnt work. I've done everything exactly as you say, yet the image will not pop in a new window.
you can see @ http://gallery.verymisunderstood.com
there is a javascript error on the page , this i know, I know what is causing that, as your view photo.php doesnt have my mod in it for my menu at the top of my screen. Ive chosen not to fix it, since, its looking like i will have to revert back to my original files.
have a look.
your guess is my best means of attack.
Posts: 53
Does anyone have the latest gallery v1.4.4-pl4 version?
And if it isn't too much trouble can someone attach the edited stock files.
thx!
Posts: 271
I have yet to get it working in 1.4.4. Still in process of working with it.
the files above were stated to work in 1.4.4 pl4 but I can't seem to get em running, Im about to revert back to my originals and just wait for Gallery 2 to hit production release.
I suppose this mod isnt that important to me , as most of my pictures are left within the confines of a 320 x 240 ratio. and fit on the screen anyway.
Posts: 27300
khsjr1970, It uses javascript to open the new window so you have to fix your javascript error first then I bet it would work.
tmothy, have you read the thread? chet did it for you and has the files: http://gallery.menalto.com/index.php?name=PNphpBB2&file=viewtopic&p=105797#105797
Dave