Popup script available for download

domesticat's picture

Please note that this code has been updated. See this entry for the updated version.

After a couple of inquiries, I decided to make my new PHP/javascript toy available. The script I used to do the image popups (without needing a HTML file for each picture) is a modification of a script originally written by Anarchos, which needed some tidying and changing before I was happy with it. A copy of my modification of the original script, plus a bit of direction on how to use it, is available here. (a 2k .zip file)

Believe me—if you were faced with creating 700-plus static HTML files just so that you could display popups, you’d go digging for a script, too.

(Thanks again to Gareth for zapping the code into shape, and Scott for the right suggestion at the right time.)

reb's picture

i know this is an ancient post, but i seemed to remember seeing it here. thank you!
Dr C.R. Staalman's picture

I see beautiful pop menus in http://lucent.com nice layout, easy navigating. In the source I don't understand the point, where popup (1) , popup (3) and popup (4) stand for. Can you help me? My sites: http://siopel.org http://artsenverbond.nl Thenk you / CR Staalman
domesticat's picture

The Lucent site uses popup menus, a very different thing. This script is to pop images up in a separate window without having to create a static HTML page for each one. Sorry.
Lynda's picture

I was looking at this code Amy, as I put something similar together for my photo page and wanted to see how you do it. It seems a bit too javascript-centric to me, no? I think it all depends on how much info you want to transfer in the URL, but this way the window won't popup tiny and then resize itself. You could setup something like this, (I'm sure it can be customized to make it much more user friendly) defining a new function: Line breaks on the 'print' line are mine. Take them back out. This is just for display purposes. <? function popup($file, $title) ( $path = "http://www.yoursite.com"; $size = getimagesize("$path$file"); $width = $size[0]; $height = $size[1]; print "<a href=\"#\" onclick=\"window.open ('http://www.yoursite.com/pathto/popup.php?z= $path$file&width=$width&height=$height& title=$title','photopopup','width=$width,height=$height,directories=no, location=no,menubar=no,scrollbars=no,status=no,toolbar=no,resizable=no, screenx=50,screeny=50');return false\">$title</a>"; ) ?> And then it can be called like this: <? popup("/path/to/file.jpg","Description of Picture"); ?> The popup.php doesn't need to be anything more than a normal HTML page, with all the margins set to 0 and an echo line something like this: <? echo "<img src=\"$z\" width=\"$width\" height=\"$height\" border=\"0\" alt=\"$title\" />"; ?> Sorry if I'm stepping on toes here. I always like going with PHP in favor of javascript because javascript is so client-side and here the only javascript used is the normal window.open, which most browsers can handle without a problem. --- By the way - THANK YOU Amy. You got me started with PHP way back with the skinning and I've done nothing but learn since. It's too cool not to learn. ;) Have a great day.
domesticat's picture

Lynda - no toes stepped on at all! I've already emailed you to tell you this, but this is a script I've wanted to revisit for a while. I've known there were problems with it, but other things took precedence. I suspect you just eliminated some work on my part. I'm ALL about that. :)

Post new comment

User login

Recent comments

  • Anonymous 5 days 6 hours ago [view]
  • albert (spain) 3 weeks 5 days ago [view]
  • Kelly | Mens Suits 4 weeks 2 days ago [view]
  • Anonymous 5 weeks 1 hour ago [view]
  • Suzanne Nelson 5 weeks 3 days ago [view]

Search

Hello, anonymous!

If you're seeing this, you're not logged in. A lot of content here is only visible if you're logged in, and comments by anonymous users are held for moderation. Consider getting an account to save yourself some frustration?

domesticat.net

is the home of Amy Qualls-McClure since 2000. She is a Drupal / quilt geek in Huntsville, Alabama. One spouse, two cats, no kids, lots of opinions.

Public account for work and Drupal stuff: Private account for friends and personal life:

me on plurk me on drupal.org my music habits on last.fm my photos on flickr my bookmarks on del.icio.us my bookmarks on pinboard.in Amy Q. on foursquare what I'm reading

Some content is locked. Copy these links AFTER logging in for a query string giving you full feed-reader access:

Atom feed, entries RSS feed, entries RSS feed, comments