Script: Updated popup script available for download

Tags:

(Looking for the version that does popups based off of thumbnail images? Go to entry 870) for that script.)

Lynda posted a comment on my original popup-script post, giving me some excellent ideas for improving my existing popup script.

Ok, ok, really, it's a totally new script that does the same thing. Hers was much better than mine. A few tweaks and error-checking bits later, and the script is rock-solid enough to even please Gareth.(For those of you who have never written code and tried to get it past Gareth's muster, let me tell you, he's a tough taskmaster. The number of times he's whispered to me, "But a user could sabotage your script by sending this variable…" is going to stay strictly between the two of us.)

What the script does, in a nutshell: it makes it easy to automatically generate popup windows for images. These windows will be automatically sized to the size of the image, and will close themselves when the user goes back to the main window.

You can pick up a copy of the script, and the full directions, in this 2K popup.zip file. Enjoy, and happy posting!

Amy - thanks for having your PHP guru give this the once-over and writing up the wonderful tutorial on it!! :)


Parse error: syntax error, unexpected '&' in /var/misc/httpd/domesticat.net/html/includes/common.inc(1352) : eval()'d code on line 3

Hi Amy, I am dealing with the exact same problem as Sasha.... found a solution yet??? (or are we just not seeing the obvious?) thx mucho

domesticat's picture
Yeah, I'm afraid the problem is on your end. The script generates the text '[error creating link to file]' when it either cannot find the file you're pointing to or doesn't have permission to read the file. The script is expecting your path (the first thing placed inside the parentheses) to be a relative path, not an absolute path. The script builds a full URL to your image by putting together two things: 1) The server name as determined by PHP (if you want to change that, see line 4 of the index.php file included in the zipfile) 2) The relative path you supply as part of the popup() function. Chances are, the reason you're having issues is because you're using full URLs in the path declaration in the popup() function.


Parse error: syntax error, unexpected T_STRING, expecting T_VARIABLE or '$' in /var/misc/httpd/domesticat.net/html/includes/common.inc(1352) : eval()'d code on line 13

domesticat's picture
Uh, no. I take it you're fairly new to PHP? I'll give you the answer, but there are a couple of things you should read... See this page for why what you tried won't work, and this page for an explanation of putting strings and variables together. Try this instead: $path = "http://members.lycos.co.uk/forum01/";

GREAT! it´s working....and yes I am new to PHP. Now I just have to figure out how to make this work from a thumbnail gallery..... :-) but that´s another story...... thanks for your support..... mucho

First of all, I just want to say that I love this script and it's been very helpful, so thank you very much for posting it. Second, I was wondering if there is a way to make it work with thumbnails as opposed to text descriptions? I know a bit of PHP, but it's not much, and I've been (horribly x_x) unsuccessful trying to make it work with thumbnails. Can this be done? I'd love it if you'd point me in the right direction. Thanks Ves

I believe this has already been asked but not answered so I'll try again :) Instead of having it have to be linked off of TEXT - any way (or is there a hack) to have it linked off an IMAGE (i.e. thumbnail)?! *wishing and hoping and...* :)

Hi, I was wondering if there was any possibility to tune the popup script for a flash file... Please kindly let me know Thanks Stefano

domesticat's picture
My standard response is goes something like this: I only do scriptwriting/script mods for people I don't know after some kind of bribery from my wishlist. My amazon wishlist is here. I know it probably seems heartless to do this, but I've found that someone who isn't willing to pony up $10 for a used book or used CD (and no, I don't mind used ones at all) tends to want something for nothing. If you don't mind tossing something my way, find the "email me" link on this page and get in touch. We'll work something out.

Is there a way to have this work instead of a text hyperlink have it so it is linked to a thumbnail? example: popup("/old/1Pizza.jpg","/old/pizza-thumb.jpg") Thanks for any light on this!

can this script be modified so the window can be bigger than the photo so you can add info around the photo?

domesticat's picture
First up - anyone looking for the popup script using thumbnails should go to this page, as I posted that script a while back. (Thanks, Sarah, for reminding me to do that.) Patrick - it's possible, but that's a major revision. I'll repeat what I said just a few comments up from this one: I don't do major script changes for people that I don't know without some kind of token compensation off my wishlist.

I've noticed one odd thing on this script. On my page, I've got the random entry script and the popup script and if the popup is in the text of the random entry, it disappears. The words that are linked in the script disappear completely.

gfmorris's picture
That's because the random-entry script doesn't parse the PHP in the popup() script for you.

Ok, earlier I wrote about the script not working for me. Two things have changed, I am now a member, and I know now php 4.3.1 has a bug. I have done some research, it seems that many have the same problem as me. Using getimagesize() [0] [1] delivers no info. Does anyone know a workaround? fritz

I'm using the popup script and successfully creating links to images. When I call the script from a within a table the links end up outside the table. I'm doing something like: echo ""; echo ""; echo "". popup($row["pic"],'Photo') .""; etc., etc. "pic" in this case is just the path to the image which is stored in a database. Any ideas? TIA

Oops. HTML was dropped.
Syndicate content