[Working] Full size popup for G1.5

notgoddess
notgoddess's picture

Joined: 2005-04-03
Posts: 178
Posted: Fri, 2005-09-09 06:00

Rather than tackle the 'can it work' here's a simple popup for album pages.
If you want all the frills you'll probably see how to make it work from this.

Note that this leaves the href intact-that way people who have JS or possibly popups disabled can still see the image on the view_photo page. It's more accessible than requiring them to have popups enabled.

Copy inline_imagewrap.inc to a new file - inline_photothumb.frame (the latter file by default includes the former, but we want a couple changes). Leave inline_photothumb.frame.default alone.

Just above
if (!empty($href) ) {

add:

if($GLOBALS['i']) {
   $photo = $gallery->album->getPhoto($GLOBALS['i']);
   list($iw, $ih) = $photo->getDimensions(0); // gets sized dim if any.

   $path = $gallery->album->getPhotoPath($GLOBALS['i']);
   $path2 = $gallery->app->photoAlbumURL.'/html_wrap/popup.php?file='
                 .urlencode($path);

   $params = 'height='.($ih+50).',width='.($iw+25).',directories=0,location=0,menubar=0,scrollbars=0,status=0,toolbar=0,resizable=1';
   $onclick = "window.open('{$path}','fobar','{$params}'); return false;";
   $attr .= ' onclick="'.$onclick.'" ';
}

Using $path opens just the image in a new window-the user clicks the x to close it. For a popup w/ a bit of styling & a close link, change the $path in the $onclick line to $path2 and have this file (popup.php) in your html_wrap dir/ (or change the path accordingly if you put it elsewhere:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
   <title>Item Detail</title>
   <meta http-equiv="content-type" content="text/html; charset=UTF-8" />
   <meta http-equiv="Content-Style-Type" content="text/css" />
   <meta name="author" content="Sara Jacobson, NotGoddess Designs saraj(at)notgoddess.com" />
   <meta name="description" content="A close look at the selected item." />
   <style type="text/css" id="internalStyle">
      html, body { margin:0; padding:0; text-align:center;background:#FEFEFE;}
      img { border:1px black solid; display:block; }
      span.closep { cursor:pointer; font-weight:bold; text-decoration:underline; }
   </style>
</head>
<body>
<?php
$file = (isset($_REQUEST['file']) && $_REQUEST['file'] ? $_REQUEST['file'] : '');
if($file) { $file = urldecode($file); echo '<img src="'.$file.'" />'; }
?>
<span class="closep" onclick="window.close()">Close</span>
</body>
</html>

 
Nahoo
Nahoo's picture

Joined: 2005-08-22
Posts: 6
Posted: Sat, 2005-09-10 23:32

My code in my second post does everything you need from a popup, standalone or otherwise. I posted it complete so that people only need to source this and nothing before or after.

I messed around with the first bits of code and they came up with errors. Also, they didn't work as I would wish them to. If a big window appears before you bearing one large photo, you would want to have an easy close option. If the entire window can be one large "close" button, then this is the most logical option.

I have made two sites since posting this using exactly the code as on page 3:

Standalone: http://bespokeglass.com
CMS (Mambo): http://d2tm.duneii.com

 
notgoddess
notgoddess's picture

Joined: 2005-04-03
Posts: 178
Posted: Sun, 2005-09-11 00:57

Wasn't trying to one-up you, just had a person ask me to make it work and had no desire to wade through the thread to see where errors/fixes were.
Ng

 
Nahoo
Nahoo's picture

Joined: 2005-08-22
Posts: 6
Posted: Sun, 2005-09-11 10:42

I know, I didn't post in response to your message.

 
stounedi

Joined: 2005-09-26
Posts: 15
Posted: Thu, 2005-10-06 13:35

Well, I copied the text with ctrl-c and pasted it into my php and it is exactly the same as on the page, yet I get this error:

Parse error: parse error, unexpected '&', expecting '(' in c:\Inetpub\wwwroot\gallery\util.php on line 35

I think the text on the forum looks a bit wierd, its full of the $#40 thingies, none of those are found in my original .php's. I noticed this when I copied the text from the forums and tried to search through the .php's.

Ok got it figured out. &#40 = ( and &#41 = ) and so on... But pasting this into my .php code does not work. So I need to figure out how to replace them all. Maybe IE will show it correctly. Opera doesnt (on this forum). I cant even change to this page 2 on Opera because it doesnt allow me to scroll the page horizontally :).

EDIT: Nope, IE doesnt show them correctly either. Any ideas how to get all that mess into working php?

 
mindless
mindless's picture

Joined: 2004-01-04
Posts: 8601
Posted: Fri, 2005-10-07 16:12

The entities in old posts is an artifact of moving to the new forums.. check this topic again in the next couple days and they should be cleaned up.

 
itsnotlevel

Joined: 2005-09-28
Posts: 25
Posted: Thu, 2005-11-10 03:38

Hey guys, tried to do the hack at the beginning of this topic, and all i get is

Parse error: parse error, unexpected $ in /home/sinner/public_html/gallery/util.php on line 3484

 
hevier

Joined: 2005-11-11
Posts: 1
Posted: Fri, 2005-11-11 20:24

Thank you NotGoddess!!! It works great. However... I would like scrollbars. Some of the images fit fine, but some of the taller ones need some scrolling. How would I do this?

Thanks
hevier

 
notgoddess
notgoddess's picture

Joined: 2005-04-03
Posts: 178
Posted: Sun, 2005-11-13 05:09

Just change the params to read scrollbars=1 instead of scrollbars=0

 
hooby

Joined: 2005-02-10
Posts: 2
Posted: Sun, 2006-02-05 19:36
Nahoo wrote:
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:

$href= makeAlbumUrl($gallery->session->albumName, $id, array("full" => 1));

...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?

I have tried the three solutions in this thread and have had no luck. I am using the latest version of gallery (1.5.2) embedded into PostNuke 0.761. I have searched the forums and I believe this is the best thread about “full size in new window”. If there is another thread I overlooked please point me in the right direction.

With that said Nahoo’s version seems to *WORK* the best. It works perfect when it is not embedded into postnuke. But almost works in post postnuke. What do I mean by that? If I insert the code into my gallery and I click on an image I will get a popup with an error

Quote:
Fatal error: Call to a member function on a non-object in /home/hoobynet/public_html/modules/gallery/classes/User.php on line 155

Now if I navigate to my gallery installation without postnuke at http://www.hooby.net/modules/gallery/ everything works fine! But here is the weird part! If I got back to my gallery imbedded into postnuke everything works. No more errors.

Anybody else having similar problems?

You can view my website embedded in postnuke here: http://www.hooby.net/modules.php?op=modload&name=gallery&file=index

And standalone gallery here: http://www.hooby.net/modules/gallery/

Try going to the embedded site first then standalone and back to embedded. You will see embedded doesn’t work, standalone works and then embedded works. I hope you understood all of that.

Thank you