Jump to content

Recommended Posts

Hi everyone,

 

A friend of mine has a photo gallery on his site, which is built with PHP (and I imagine the gallery also uses javascript). The gallery uses thumbnails, which are auto generated when you upload photos to specific locations (four total), then when you click on one, a lightbox popups up with a larger version. There are also 'back' and 'next' arrows along with a nav of sorts that says what photo you're on (5/6, 1/8, etc) If the photo folder on the server has more than four, the CMS prints a link that says "+5 more" or however many more in the thumbnail area. When you click that link, the lightbox appears, starting on the next photo in line.

 

There are three problems. First, the thumbnail area always shows one less photo than what we actually uploaded. Second, the '+X more' link also miscounts the remaining photos after four (one less to be exact - same as the thumbnail display). Third, if I click on the 'more' link, the lightbox correctly counts the total number of photos, but the very last one generates a message - "'/var/www/html/PROJECTS/RESIDENTIAL/James Residence' is not a file".

 

Here is some of the code. Line 112 is where it starts to print the thumbnail div area; line 141 prints the actual thumb; line 150 prints the 'more' link; line 155 looks like it does something important, not sure what it is.

 

#    # Only grab directories - Leave files alone
#     #------------------------------------------ 
# $s=1;
# $anchor=1;
# if (is_dir($npart)) {
#  
# $display_name = str_replace("_"," ",$npart);
# $display_name = str_replace("DOT",".",$display_name);
# $display_name = str_replace("APO","'",$display_name);
#         print "     <div id='project_title'>".strtoupper($display_name)."</a></div><div id='project_thumbs'>";
# $d = dir("$npart/");
# $tb = 0;
# while (false !== ($file = $d->read())) {
#  
#  
# while (false !== ($file = $d->read())) {
# if ($file != "." && $file != ".." && $file != ".DS_Store") { $tb++; }
#  
#  
#  
# if ($s < 5) {
#     if ($file != "." && $file != ".." && $file != ".DS_Store") {
#  
#  
#  
# $size = getimagesize("$npart/$file");
# $width = $size[0] + 75;
# $height = $size[1] + 132;
#  
# print "<a  rel=\"gb_imageset[$display_name]\" title=\"$display_name\"  href='phpThumb.php?src=PROJECTS/$which_project/$npart/$file&w=800' rel='$npart'><img src=\"phpThumb.php?src=PROJECTS/$which_project/$npart/$file&w=78&h=48\" width=\"78\" height=\"48\"></a>";
# $s++;       }
#  
#  
# $anchor++;
#  
#     }
# elseif ($s == 5) {
#  
# $more_link = "<BR><div style='position:relative; top:-68px; left:270px; display:inline; float:none; margin-bottom:-10px;'><a class='morelink' href='phpThumb.php?src=PROJECTS/$which_project/". $npart. "/" .$file. "&w=800' rel=\"gb_imageset[$display_name]\">";
# $tb_links = "";
# $s++;      
#  
# }      
# elseif ($s > 5) { $tb_links = $tb_links . "<a style='display:none;' href='phpThumb.php?src=PROJECTS/$which_project/$npart/$file&w=800' rel=\"gb_imageset[$display_name]\" ></a>"; $s++; }
#         $z++;  
#        
#     }
#  
#     }
# $tb = $tb - 4;
# if ($tb < 0) { $tb = 0; }
# if ($tb > 0) { print $more_link."+ " . $tb . " more photos</a></div>"; print $tb_links;}
#  
#  
# print "</div>";
# }

 

Here is the site in question - http://www.newcastlepllc.com/projects.php

 

Thanks much. I hope it's a simple bug. I'm a web developer but not a PHP programmer :)

 

Sue

 

 

 

[attachment deleted by admin]

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.