...

View Full Version : Passing Images To Popups?



otbt
01-23-2010, 08:11 PM
Hi everyone, first post on the forums!

This is the basic script I am using for a photo album on a website I am designing. It uses a flat file database instead of MySQL.


Contents of the image gallery page album.php:


<?php
$lines = file('photos.dat');
foreach ($lines as $line_num => $line)
{
$tmp = explode('/*/*/', $line);
$photo = $tmp[0];
$thumb = $tmp[1];
$shortdesc = $tmp[2];
$longdesc = $tmp[3];

echo '<TABLE>';
echo '<TD><IMG SRC="'.$thumb.'"><BR>'.$shortdesc.'</TD>';
echo '</TABLE>';
}
?>


This is the format used for the arrays in the database file photos.dat:


./images/photo1.jpg /*/*/ ./images/th_photo1.jpg /*/*/ Short Desc /*/*/ Long Desc
./images/photo2.jpg /*/*/ ./images/th_photo2.jpg /*/*/ Short Desc /*/*/ Long Desc
(and so on)


What I'd like to be able to do is have $photo along with $shortdesc and $longdesc passed to a new popup window (with no scrollbars and a fixed size) when the thumb is clicked on, I've tried echoing Javascript but it just doesn't seem to work, nothing happens when the thumb is clicked on. Can anyone help me out here? Thanks in advance to anyone who can.

Dormilich
01-24-2010, 02:18 PM
What I'd like to be able to do is have $photo along with $shortdesc and $longdesc passed to a new popup window (with no scrollbars and a fixed size) when the thumb is clicked on, I've tried echoing Javascript but it just doesn't seem to work, nothing happens when the thumb is clicked on.
do you have any JavaScript to do that, yet? passing the descriptions to the new popup window could be a little bit more difficult (depending on the size of the text), in the “worst” case, you have to make a whole new page to show the full image (instead of only passing the image URL).

JAY6390
01-24-2010, 02:47 PM
It's pretty simple to do. Use something like (this is Javascript BTW)


windowHandle = window.open("", "Window Title");
bodyHTML = '<body><div>Hello! This is a test</div></body>';
windowHandle.body.innerHTML = bodyHTML;
Hopefully that should give you some ideas as to how it works. It's pretty simple



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum