| View previous topic :: View next topic |
| Author |
Message |
dacool25
Joined: 29 Apr 2007 Posts: 60
|
Posted: Mon May 28, 2007 10:38 am Post subject: Lightbox |
|
|
Hey Humpa. Sorry to be cluttering up your forum, but i have a new question. I was wondering if it would be possible to use lightbox for displaying images instead of phpthumb.
Which files would have to be edited? So far i have found phpthumb in the index.php file, functions.php file. Thanks for your help.
And PS here is a link to what lightbox does if you're not familiar with it:
http://www.huddletogether.com/projects/lightbox2/ |
|
| Back to top |
|
 |
dacool25
Joined: 29 Apr 2007 Posts: 60
|
Posted: Mon May 28, 2007 10:45 am Post subject: |
|
|
Actually, now that i think about it. I wouldn't be replacing phpthmb would I? phpthumb just makes the images smaller. So what i would try to do is get rid of the top large preview table, and when you click the thumbnail image have lightbox pick it up and preview it. But when you click the name link it will go to the full sized image (so that i can still view it on my cell).
So i guess my first question is, where would i put:
| Code: |
<script type="text/javascript" src="js/prototype.js"></script>
<script type="text/javascript" src="js/scriptaculous.js?load=effects"></script>
<script type="text/javascript" src="js/lightbox.js"></script>
|
..and the rest of the code for it. |
|
| Back to top |
|
 |
Humpa Site Admin

Joined: 06 Nov 2005 Posts: 10258
|
Posted: Mon May 28, 2007 10:46 am Post subject: |
|
|
| probably ... you'd just have to edit the index.php file .... and get rid of all the formatting for displaying the img tags, and simply display them all with no formating and replace the src= tag with a the tag like lightshow uses instead |
|
| Back to top |
|
 |
dacool25
Joined: 29 Apr 2007 Posts: 60
|
Posted: Mon May 28, 2007 10:55 am Post subject: |
|
|
Okay but where would i put the script type = ...
Would it be before the <?php or after? |
|
| Back to top |
|
 |
Humpa Site Admin

Joined: 06 Nov 2005 Posts: 10258
|
Posted: Mon May 28, 2007 11:23 am Post subject: |
|
|
Any place you see an img tag with src="phpThumb.php?........."
you need to edit those img tags.
the stuff after the phpThumb.php? and before the & is the image src
then you just add iin the rel= code as per light box
That should be about it.
I was thinking we had to rewrite the index.php, but you don't want to do that, because then you will lose your videos and audio and comments
you will also need to stick the javascript includes in the function head in the functions.php |
|
| Back to top |
|
 |
dacool25
Joined: 29 Apr 2007 Posts: 60
|
Posted: Mon May 28, 2007 11:40 am Post subject: |
|
|
You'll have to excuse me for being a complete noob.
Okay so i'm starting at the functions.php
Right now i have:
| Code: |
function head() {
include("config.php");
global $uplink,$page_title,$style_cookie,$stlye1,$$style_cookie;
$style_cookie_file = $$style_cookie;
if($style_cookie != "" AND file_exists("$uplink$style_cookie_file")) {
$style1 = "$style_cookie_file";
}
echo "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">\n";
echo "<html>\n";
echo "<head>\n";
echo "<title>$page_title</title>\n";
echo "<META HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html; charset=ISO-8859-1\">\n";
echo "<LINK REL=\"StyleSheet\" HREF=\"".$uplink."$style1\" TYPE=\"text/css\">\n";
echo "<script type="text/javascript" src="js/prototype.js"></script>";
echo "<script type="text/javascript" src="js/scriptaculous.js?load=effects"></script>";
echo "<script type="text/javascript" src="js/lightbox.js"></script>";
echo "</head>\n";
echo "<body>\n";
}
|
and i am getting a
| Code: |
Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' in /home/mysite/public_html/mms/functions.php on line 21 |
Should i be putting a \ after script type =
Thanks again Humpa. |
|
| Back to top |
|
 |
Humpa Site Admin

Joined: 06 Nov 2005 Posts: 10258
|
Posted: Mon May 28, 2007 11:44 am Post subject: |
|
|
after some more looking and whatnot, this won't work
You do not want to edit the code, because the lightbox does not affect the displaying of the thumbnails, it only affects the displaying of the pic itself
You need the phpThumb to display the thumbnails, because my script does not make any thumbnails - the phpThumb makes the thumbnails and cache's them.
And if you used lightbox in the <a href links (which is where the lightbox stuff goes), then you will not be able to see or use comments or see the text that was sent with the mms pic |
|
| Back to top |
|
 |
Humpa Site Admin

Joined: 06 Nov 2005 Posts: 10258
|
Posted: Mon May 28, 2007 11:46 am Post subject: |
|
|
and just so you know, when you add html to your php code, you have to do it like all the other code is. See how you have to put a backslash before the quotes?
Since you use echo "a bunch of stuff here";
That line is using the quotes to contain what it is going to echo out ... see that?
So, if there are quotes in the actual line that you are echo'ing out, you need to put a backslash before them so that the php knows to ignore them and continu on untill it gets to a real quote that denotes the end of that line |
|
| Back to top |
|
 |
dacool25
Joined: 29 Apr 2007 Posts: 60
|
Posted: Mon May 28, 2007 12:02 pm Post subject: |
|
|
Ohhh, okay. Yeah i wasn't sure about the / before everything when using php, i'm most familiar with html, but still not even very familiar with that.
But i was just wondering, this theoretically would work if i used the index.php that doesn't display thumbnails right? |
|
| Back to top |
|
 |
Humpa Site Admin

Joined: 06 Nov 2005 Posts: 10258
|
Posted: Mon May 28, 2007 12:04 pm Post subject: |
|
|
| dacool25 wrote: |
Ohhh, okay. Yeah i wasn't sure about the / before everything when using php, i'm most familiar with html, but still not even very familiar with that.
But i was just wondering, this theoretically would work if i used the index.php that doesn't display thumbnails right? |
Yes, just add the javascript lines like you did, and add the lightbox css code to the style file you are using
Then edit any <a href link in the index.php that is a link around an img tag and add in the rel=lightbox thing
EDIT: and it will work just as well iin the normal index.php also. Since it is only the <a href tag you are editiing |
|
| Back to top |
|
 |
dacool25
Joined: 29 Apr 2007 Posts: 60
|
Posted: Mon May 28, 2007 1:03 pm Post subject: |
|
|
I'm not sure if you can help me or not, but here is my problem. Right now i am using the nothumbs index page and i have everything working, and the lightbox will come up, but no image will appear.
Here is my current code:
| Code: |
}else {
if($media == $media_time) {
$media_table .= "\t\t<IMG SRC=\"$path_to_media$thumb_pic\" width=\"$thumb_width\" border=\"0\" alt=\"$datestamp\" title=\"$datestamp\"><br>$datestamp\n";
}else {
$media_table .= "\t\t<a href=\"index.php?p=$p&media=$media_time\" rel=\"lightbox\">\n\t\t<IMG SRC=\"$path_to_media$thumb_pic\" width=\"$thumb_width\" border=\"0\" alt=\"$datestamp\" title=\"$datestamp\"><br>$datestamp</a>\n";
}
}
|
[/code] |
|
| Back to top |
|
 |
Humpa Site Admin

Joined: 06 Nov 2005 Posts: 10258
|
Posted: Mon May 28, 2007 1:06 pm Post subject: |
|
|
you need to change the path to the image as well
<a href=\"index.php?p=$p&media=$media_time\"
should be the same thing as the src path in your image tag ... lightbox simply shows the pic, that's why i was saying you would no longer be able to comment or see the full text that was sent in the pic, or anything else that is on the actual pic page that my humpa_mms uses
<a href=\"$path_to_media$thumb_pic\" |
|
| Back to top |
|
 |
dacool25
Joined: 29 Apr 2007 Posts: 60
|
Posted: Mon May 28, 2007 1:37 pm Post subject: |
|
|
Alright everything works. The only thing is that with the no thumbs index, the title "all media", and the large preview table are on the left side of the page, and all of the thumbnails are centered like they should be. But then once you get down to the page numbers they're aligned down to the bottom again. How can i fix this? I've been messing around with it all day and still haven't gotten everything aligned.
PS. What i would really like to do is just take out the large image preview (the one on the top) and then have the bottom page links centered. How can i do this? |
|
| Back to top |
|
 |
Humpa Site Admin

Joined: 06 Nov 2005 Posts: 10258
|
Posted: Mon May 28, 2007 1:46 pm Post subject: |
|
|
I'm not following.
for one thing, you are simply wasting bandwidth using the nothumbs.
If your regular index.php works, simply edit the <a href tags in that.
As for the alignment, did you edit something incorrectly? Start over with a working file that is aligned correctly and then edit the <a href tags.
I don't know what this "all media" thing is you are talking about. I don't have that on my page.
once you get your index.php edited correctly, then taking out the main pic at the top is easy and I'll show you what code to remove |
|
| Back to top |
|
 |
Humpa Site Admin

Joined: 06 Nov 2005 Posts: 10258
|
Posted: Mon May 28, 2007 1:52 pm Post subject: |
|
|
You can get rid of the pic that shows at the top by simply commenting out this line with two slashes, like so:
//show_first_media($this_media_group,$media_time,$media_time_all); (line 150)
and this line:
//show_first_media($show_this_media_group,$media,$media_time_all); (line 241)
leave the function show_first_media line alone, just comment out those other two lines |
|
| Back to top |
|
 |
|