Jump to content

lightbox iframe > include


firewing

Recommended Posts

Hi there php freaks,

 

I'm having some problems with this script I downloaded called lightbox and I was really hoping someone here could help my with them.

I expect most of you know this script by name. I found a version on a german website that doesn't only create the fancy pants visual effects but also creates thumbnails and tables by itself!

 

The problem is the script comes with a page called index.html that has an <iframe> code in it to link to a page called pics.php which has al the code for the gallery in it. This is a problem because my site is mostly php, and I don't like working with iframe.

 

So I decided to use the include command to call on the pics.php file instead of using an iframe. This is where it gets tricky.

The page shows up with the pictures all right, but the animation from lightbox doesn't execute!

 

Are there any known differences between iframes and include that I should know about?

 

Heres an idea of what I mean, this is what the page looks like with the iframe:

http://graham.firewings.net/cyanidesite/pics/index.html

 

And this is the page that has the include command in it:

http://graham.firewings.net/cyanidesite/?sec=pics

 

See the difference.

Heres the code for the working index.html file (iframe):

html>
<head>
<title>Pictures/</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script type="text/javascript" src="js/prototype.js"></script>
<script type="text/javascript" src="js/scriptaculous.js?load=effects"></script>
<script type="text/javascript" src="js/lightbox.js"></script>
<link rel="stylesheet" href="css/lightbox.css" type="text/css" media="screen">
<style type="text/css">
<!--
body {
background-color: #000000;
}
.header {
font-family: "Times New Roman", Times, serif;
font-size: 20px;
font-weight: bold;
color: #FFFFFF;
}
-->
</style></head>
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<p class="header">// Pictures</p>
<iframe align="left" width=800 height=300 frameborder="0" marginheight="0" marginwidth="0" name="DisplayFrame" scrolling="auto"  src="http://graham.firewings.net/cyanidesite/pics/gallery/pics.php"></iframe>
</body>
</html>

 

And heres the code for the non-working pics.php file (include):

<?php
// iFrame Gallery v1.0
//  published under GNU GPL License
//  developed by MiNiMaG
//  contact: minimag@haxxxor.de

$galleryurl = "http://graham.firewings.net/cyanidesite/pics/gallery/"; // WHERE IS THE GALLERY ? (with / at the end)

$linkpictures = "on"; // Link pictures? Press P/N or klick PREV/NEXT to switch through pictures [on/off]
$showpicnames = "on";	// Show picture names? [on/off]
$maxthumb = "100"; 		// Maximum width/height of thumbnail
					          // on change: you have to upload all pictures again for resizing

$resize = "on"; 		  // Resize the picture after upload? [on/off]
$maxpicture = "800"; 	// If resizing is activated: Maximum width/height of picture
					          // on change: you have to upload all pictures again for resizing
$bgcolor = "000000";
$perline = "6"; 		  // Maximum number of thumbnails per row

$cellbg = "333333"; 	// Backgroundcolor of the cells
$cellheight = "100"; 	// Height of a cell
$cellwidth = "100"; 		// Width of a cell


// The other way to set the style:
// Use GET variables. Usage: 
// on loading iframe add ? after pics.php ant then set the variabes
// to add more variables use &
// example : src="./gallery/pics.php?perline=1&bgcolor=0e0e0e&cellbg=00ff00"

IF (isset ($_GET['linkpictures'])) $linkpictures = $_GET['linkpictures'];
IF (isset ($_GET['showpicnames'])) $bgcolor = $_GET['showpicnames'];
IF (isset ($_GET['bgcolor'])) $bgcolor = $_GET['bgcolor'];
IF (isset ($_GET['perline'])) $perline = $_GET['perline'];
IF (isset ($_GET['cellbg'])) $cellbg = $_GET['cellbg'];
IF (isset ($_GET['cellheight'])) $cellheight = $_GET['cellheight'];
IF (isset ($_GET['cellwidth'])) $cellwidth = $_GET['cellwidth'];


// Here is some HTML to change style:
// DON'T CHANGE BODY ONLOAD !!!
?>

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script type="text/javascript" src="http://graham.firewings.net/cyanidesite/pics/js/prototype.js"></script>
<script type="text/javascript" src="http://graham.firewings.net/cyanidesite/pics/js/scriptaculous.js?load=effects"></script>
<script type="text/javascript" src="http://graham.firewings.net/cyanidesite/pics/js/lightbox.js"></script>
<link rel="stylesheet" href="http://graham.firewings.net/cyanidesite/pics/css/lightbox.css" type="text/css" media="screen">
</head>

<body BGCOLOR=#<?PHP echo $bgcolor; ?> LEFTMARGIN=0 TOPMARGIN=0 MARGINWIDTH=0 MARGINHEIGHT=0 onload="parent.initLightbox();">

<table border="0" align="center" cellpadding="0" cellspacing="2">


<?PHP

// DON'T CHANGE ANYTHING UNDER THIS LINE !!!
$thumburl = $galleryurl."thumbs/"; 
$pictureurl = $galleryurl."pictures/"; 
$folder = "./upload/";

if($folderpointer = opendir($folder)) 
{
    while($picture = readdir($folderpointer))
    {
        if(!is_dir($picture))
        {
            $pictures[] = $picture;
        }
    }
    closedir($folderpointer);
}

if (count($pictures) > 0)
{ 
for($x=0;$x<count($pictures);$x++)
{
$Picturename = str_replace('%20','-',$pictures[$x]); 
$Picturefile = "./upload/".$pictures[$x];
$Picturedata = getimagesize($Picturefile);
$OriginalWidth = $Picturedata[0];
$OriginalHeight = $Picturedata[1];
$ThumbnailWidth = $maxthumb;
if($OriginalWidth < $ThumbnailWidth)
{
     $ThumbnailWidth=$OriginalWidth;
}
$Scaling = $OriginalWidth/$ThumbnailWidth;
$ThumbnailHeight = intval($OriginalHeight/$Scaling);


If ($OriginalHeight > $OriginalWidth)
{
 $ThumbnailHeight = $ThumbnailWidth;
 if($OriginalHeight < $ThumbnailHeight)
 {
     $ThumbnailHeight=$OriginalHeight;
 }
 $Scaling = $OriginalHeight/$ThumbnailHeight;
 $ThumbnailWidth = intval($OriginalWidth/$Scaling);
} 
if($Picturedata[2] == 1)
{
     $OriginalPicture = ImageCreateFromGIF($Picturefile);
     $ThumbnailPicture = ImageCreateTrueColor($ThumbnailWidth, $ThumbnailHeight);
     ImageCopyResized($ThumbnailPicture, $OriginalPicture, 0, 0, 0, 0,
     $ThumbnailWidth, $ThumbnailHeight, $OriginalWidth, $OriginalHeight);
     ImageGIF($ThumbnailPicture, "thumbs/".$Picturename);
}
elseif($Picturedata[2] == 2)
{
     $OriginalPicture = ImageCreateFromJPEG($Picturefile);
     $ThumbnailPicture = ImageCreateTrueColor($ThumbnailWidth, $ThumbnailHeight);
     ImageCopyResized($ThumbnailPicture, $OriginalPicture, 0, 0, 0, 0,
     $ThumbnailWidth, $ThumbnailHeight, $OriginalWidth, $OriginalHeight);
     ImageJPEG($ThumbnailPicture, "thumbs/".$Picturename);
}
elseif($Picturedata[2] == 3)
{
     $OriginalPicture = ImageCreateFromPNG($Picturefile);
     $ThumbnailPicture = ImageCreateTrueColor($ThumbnailWidth, $ThumbnailHeight);
     ImageCopyResized($ThumbnailPicture, $OriginalPicture, 0, 0, 0, 0,
     $ThumbnailWidth, $ThumbnailHeight, $OriginalWidth, $OriginalHeight);
     ImagePNG($ThumbnailPicture, "thumbs/".$Picturename);
}
IF ($resize == "on") $ThumbnailWidth = $maxpicture; 
ELSE $ThumbnailWidth = $OriginalWidth; 
    
if($OriginalWidth < $ThumbnailWidth)
{
     $ThumbnailWidth=$OriginalWidth;
}
$Scaling = $OriginalWidth/$ThumbnailWidth;
$ThumbnailHeight = intval($OriginalHeight/$Scaling);


If ($OriginalHeight > $OriginalWidth)
{
 $ThumbnailHeight = $ThumbnailWidth;
  if($OriginalHeight < $ThumbnailHeight)
 {
     $ThumbnailHeight=$OriginalHeight;
 }
 $Scaling = $OriginalHeight/$ThumbnailHeight;
 $ThumbnailWidth = intval($OriginalWidth/$Scaling);
}
if($Picturedata[2] == 1)
{
     $OriginalPicture = ImageCreateFromGIF($Picturefile);
     $ThumbnailPicture = ImageCreateTrueColor($ThumbnailWidth, $ThumbnailHeight);
     ImageCopyResized($ThumbnailPicture, $OriginalPicture, 0, 0, 0, 0,
     $ThumbnailWidth, $ThumbnailHeight, $OriginalWidth, $OriginalHeight);
     ImageGIF($ThumbnailPicture, "pictures/".$Picturename);
}
elseif($Picturedata[2] == 2)
{
     $OriginalPicture = ImageCreateFromJPEG($Picturefile);
     $ThumbnailPicture = ImageCreateTrueColor($ThumbnailWidth, $ThumbnailHeight);
     ImageCopyResized($ThumbnailPicture, $OriginalPicture, 0, 0, 0, 0,
     $ThumbnailWidth, $ThumbnailHeight, $OriginalWidth, $OriginalHeight);
     ImageJPEG($ThumbnailPicture, "pictures/".$Picturename);
}
elseif($Picturedata[2] == 3)
{
     $OriginalPicture = ImageCreateFromPNG($Picturefile);
     $ThumbnailPicture = ImageCreateTrueColor($ThumbnailWidth, $ThumbnailHeight);
     ImageCopyResized($ThumbnailPicture, $OriginalPicture, 0, 0, 0, 0,
     $ThumbnailWidth, $ThumbnailHeight, $OriginalWidth, $OriginalHeight);
     ImagePNG($ThumbnailPicture, "pictures/".$Picturename);
}
unlink($Picturefile);
}
}
$pictures = $empty;
$folder = "./thumbs";

if($folderpointer = opendir($folder)) 
{
    while($picture = readdir($folderpointer))
    {
        if(!is_dir($picture))
        {
            $pictures[] = $picture;
        }
    }

    closedir($folderpointer);
}
sort($pictures);
$zaehler = 1;
echo "<tr>";
for($x=0;$x<count($pictures);$x++)
{
IF ($zaehler > $perline) 
{
  $zaehler = 1;
  echo "</tr><tr>";
}
IF ($linkpictures == "on") $rel = "lightbox[Gallery]";
ELSE $rel = "lightbox";
IF ($showpicnames == "on") $name = "$pictures[$x]";
$Picturedata = getimagesize("pictures/".$pictures[$x]);
echo '<td bgcolor="#'.$cellbg.'" width="'.$cellwidth.'" height="'.$cellheight.'" align="center" valign="middle">
<a href="'.$pictureurl.$pictures[$x].'" rel="'.$rel.'" title="'.$name.'"> <img src="'.$thumburl.$pictures[$x].'" border="0"></a></td>';
$zaehler++; 


  
}

?>
</table>
</body>
</html>

 

Sorry for the lousy coding work. The reason for this is because it's a mix between my own work and the script that I downloaden.

 

Any help would be much appreciated.

Cheers,

Graham

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.