Page 1 of 1

Popup appears with fullsize image when clicking on thumbnail

Posted: Mon Oct 04, 2004 10:50 am
by Neeke
feyd | Please use

Code: Select all

tags when posting code. Read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/color]


Hello guys.
This is the first time i post on a php forum.
At the moment i.m trying to set up an image gallery for my site. I downloaded a script and i've customized it to my needs but, as you can see [url=http://www.trozosdetiempo.net/captures2.htm]here[/url], when you click in a category, you get to a thumbnails page, and then, if you click on any of them, a new page appears with the full size image.

The thing is that i would like a pop up with only the full size image to appear when i click on a thumbnail inside the categories.

I.m a real newbie at php, but i think that maybe the key to the problem is here:

Code: Select all

/***********************************************************/
/* Shows the picture and the links related to the position */
/* in the slideshow.                                       */
/***********************************************************/

function show_picture()
{
  $dir = $_GET["dir"];
  $tot = $_GET["tot"];
  $img = $_GET["img"];

  echo "<div style='text-align: center'>";
  echo "<big>\n";
  
  if ($img  > 1)
  {
    echo "<a href='show.php?dir=$dir&tot=$tot&img=".($img - 1)."'><<</a>"; 
  }

  echo "&nbsp;&nbsp;&nbsp\n";
  echo "</big>\n";
  echo "<b>".$img."</b> of ".$tot; 
  echo "&nbsp;&nbsp;&nbsp\n";
  echo "<big>\n";

  if ($img < $tot)
  {
    echo "<a href='show.php?dir=$dir&tot=$tot&img=".($img + 1)."'>>></a>"; 
  }

  echo "</big>\n";
  echo "<br><br>\n"; 
  
  echo "<table border='0' cellspacing='1' cellpadding='0' 
               bgcolor='#000000' align='center'>\n";
  echo "<tr><td>\n";
  echo "<a href='thumbs.php?dir=$dir&img=$img'>"; 
  echo "<img src='$dir/".search_file("./$dir", $img)."' border=0 
        onLoad='resize(this);' name=foto 
        alt='Click to go to thumbnails page.'>";
  echo "</a>";        
  echo "</td></tr>\n";
  echo "</table>\n";

  
  echo "<br><br>\n"; 
  echo "<big>\n";
  
  if ($img > 1)
  {
    echo "<a href='show.php?dir=$dir&tot=$tot&img=".($img - 1)."'><<</a>"; 
  }
  
  echo "&nbsp;&nbsp;&nbsp\n";
  
  if ($img  < $tot)
  {
    echo "<a href='show.php?dir=$dir&tot=$tot&img=".($img + 1)."'>>></a>"; 
  }

  echo "</big>\n";
  echo "<br><br>\n"; 

  echo "<a href='show.php?dir=$dir&tot=$tot&img=1'>first</a>&nbsp;::&nbsp;"; 
  echo "<a href='index.php'>main</a>&nbsp;::&nbsp;"; 
  echo "<a href='thumbs.php?dir=$dir&img=$img'>thumbs</a>&nbsp;::&nbsp;"; 
  echo "<a href='show.php?dir=$dir&tot=$tot&img=$tot'>last</a>";
  echo "</div>";
}
This can be found in a document called functions.inc, and i supose that if i take "function show_picture()" and i write a propper function instead of all that, i will be able to create the pop ups. The problem is that i don.t know how to start!

I.m really lost, but any help would be great. I've been searching through the forums but i haven.t found anything yet. Sorry if i didn.t search very well and this kind of post is repeated.


feyd | Please use

Code: Select all

tags when posting code. Read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/color]

Posted: Mon Oct 04, 2004 10:57 am
by feyd
[devnet]+javascript open OR popup[/devnet]

Posted: Mon Oct 04, 2004 11:08 am
by Neeke
Oops! sorry about the missing tags!

I've been searching (again).
I do know how to make a pop up with javascript, but i cannot figure out "how to write" it in the php function. I mean, i know there's a function called "show picture" and probably, if i write there in code "i want a pop up to appear when i click on a thumbnail" it will work. But the problem is that i don.t know "how" to write it.

Sorry to seem stupid, but god! i don.t know how to explain myself when i talk about php! and besides, english is not my first language lol

btw: should i post this on the "volunteer work" forum? maybe someone would be nice enough to make it and the explain it to me.

Posted: Mon Oct 04, 2004 11:16 am
by feyd
Is show_picture the large image function? If so, it's not in this code. It'd be the code making the link to the larger image. If it isn't the large image function, I believe line 37 is where you'd want to add the popup call code. However, I'd suggest not doing a popup, as they are most often, annoying. And could easily be blocked, either by the browser not having Javascript on, or not allowing window.open calls.

Posted: Mon Oct 04, 2004 11:21 am
by Neeke
hmmm..yeah, that's true.

The problem is that when the full size appears now, as the gallery appears inside an iframe, there's a nice scroll inside.

the things is.. i've been thinking about editing the layout so the page scrolls (not the inside frame). That way it won.t look too bad when the image appears.

Anyway, thank you so much feyd and sorry for bothering you guys!