PDA

View Full Version : PHP Photo Album enhancement



aavaughan
10-12-2007, 10:46 AM
1) Script Title: DD PHP Photo Album script

2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex4/php-photoalbum.htm

3) Describe problem: increased functionality question


Hi, I posted once before and got a great response on how to change the script to where the photo file name appears beneath the photo, which allows you to do a brief description of the photo as the file name and it appears. This seemed like a logical and simple way to get an description of the photo

Please go to http://anne.swva.net/earrings.htm for my page in the works (note I haven't changed the file names to descriptions yet.)

My question is this: instead of having the file name appear on the main thumbs page, can the script be altered to have the file name appear on the enabled popup window? This allows much more room and gives more white space on the thumbs page.

THANKS in advance for help and assistance!

- AV

tech_support
10-12-2007, 10:59 AM
freaking noobs.

Your link is broken. And don't post 3 threads on the same question.

aavaughan
10-13-2007, 12:32 AM
link fixed.

jscheuer1
10-13-2007, 07:15 AM
Replace:


function popuplinkfunc(imgsrc){
if (popupsetting[0]==1){
var popwin=open(imgsrc.href, "popwin", popupsetting[1])
popwin.focus()
return false
}
else
return true
}

with:


function popuplinkfunc(imgsrc){
if (popupsetting[0]==1){
var popwin=open("", "popwin", popupsetting[1]);
popwin.document.write('<center><img src="'+imgsrc.href+'"><br>'+imgsrc.href.replace(/\.[^\.]*$/,'')+'<\/center>');
popwin.document.close();
popwin.focus();
return false;
}
else
return true;
}

aavaughan
10-17-2007, 12:57 AM
Thanks for the post John! I implemented it but ran into a couple issues I can't get around:

- Browser issue: I tested in Firefox and IE. IE doesnt show the image, just the img src path script above the title. The photo shows fine in Firefox. I can't tell where to adjust the script to make it IE friendly.
- I was hoping to show just the image name, not the entire URL path...is this possible? The current description has it all.

I posted a test page at http://www.annevaughandesigns.com/imagetest.htm so you can see what is happening.

Thanks in advance for any further help...

AV

jscheuer1
10-17-2007, 04:53 AM
Sorry, I made a typo, leaving out a closing quote. I will correct my original post, but here it is highlighted red:


function popuplinkfunc(imgsrc){
if (popupsetting[0]==1){
var popwin=open("", "popwin", popupsetting[1]);
popwin.document.write('<center><img src="'+imgsrc.href+'"><br>'+imgsrc.href.replace(/\.[^\.]*$/,'')+'<\/center>');
popwin.document.close();
popwin.focus();
return false;
}
else
return true;
}

This next part I won't change in my original post, but to trim the filename further, use this:


.replace(/^.*\/([^\/]+)\.[^\.]*$/,'$1')

instead of:


.replace(/\.[^\.]*$/,'')

So, putting it all together:


function popuplinkfunc(imgsrc){
if (popupsetting[0]==1){
var popwin=open("", "popwin", popupsetting[1]);
popwin.document.write('<center><img src="'+imgsrc.href+'"><br>'+imgsrc.href.replace(/^.*\/([^\/]+)\.[^\.]*$/,'$1')+'<\/center>');
popwin.document.close();
popwin.focus();
return false;
}
else
return true;
}

jscheuer1
10-17-2007, 05:18 AM
I just had a thought for a little further refinement, although some browsers will still insist on showing the full path in the title bar of the pop up:


function popuplinkfunc(imgsrc){
if (popupsetting[0]==1){
var popwin=open("", "popwin", popupsetting[1]), t=imgsrc.href.split(/\/|\./); t=t[t.length-2];
popwin.document.write('<title>'+t+'<\/title><center><img src="'+imgsrc.href+'"><br>'+t+'<\/center>');
popwin.document.close();
popwin.focus();
return false;
}
else
return true;
}