sherwinrulzz Posted November 23, 2011 Share Posted November 23, 2011 Hi guys , newbie on this forum just have a doubt hoping if someone could help me out with it . Requirement : Gallery (with thumbnails ) from images in a directory in a server . Solution i used :Bol gallery http://bolgallery.free.fr/ Problem : When i click on the thumbnail to view a certain image the image pops up in a new window . I want the image to load in the same page not in any other window seperately This is the part of the code for displaying image // Display the thumbnail image and set a popup link to the big one $alt = str_replace("_", " ", substr($referenceImageName, 0, -4)); $HTML .= "\t\t<TD align=\"center\">\n\t\t\t<A href=\"" . $currentImage . "\" onClick=\"bolGalleryPopup(this.href, " . $referenceImageWidth. ", " . $referenceImageHeight . ", '" . $alt . "'); return(false);\" target=\"_blank\">\n"; // target attribute to be tested $HTML .= "\t\t\t\t<IMG src=\"" . $thumbnail . "\" title=\"" . $alt . "\" border=0>\n"; $HTML .= "\t\t\t</A>\n\t\t</TD>\n"; // HTML table next line evaluation $table_i++; if (($table_i % $tableColumnsNb) == 0) { $HTML .= "\t</TR>\n\t<TR valign=\"top\">\n"; } } $HTML .= "\t</TR>\n\t<TR>\n\t\t<TD colspan=" . $tableColumnsNb . ">\n\t\t\t<FONT size=1>Generated by <A href=\"http://bolgallery.free.fr\" target=\"_blank\">bolGallery</A></FONT>\n\t\t</TD>\n\t</TR>\n"; // Thanks not to delete this line $HTML .= "</TABLE>\n<BR>\n<!--End BolGallery-->\n\n"; return $HTML; } Full code (only one page ) is here http://bolgallery.free.fr/download.php Thanks in advance Quote Link to comment Share on other sites More sharing options...
QuickOldCar Posted December 3, 2011 Share Posted December 3, 2011 Since nobody ever responded to this , I'll write a few things. To edit the way it opens the images can be done within the javascript script // Bolgallery Javascript popup function $bolGalleryPopup = "<!-- BolGallery Javascript popup window function --> <SCRIPT type=\"text/javascript\"> function bolGalleryPopup(imageFile, width, height, title){ var html = '<title>' + title + ' - Click to close </title><body leftmargin=0 topmargin=0 marginwidth=0 marginheight=0 onclick=\"javascript:window.close()\"><img src=\"' + imageFile + '\" alt=\"Click to close\"></body>'; var popup = window.open(imageFile, '_blank', 'width=' + width+ ', height=' + height + ', status=no'); popup.document.write(html); popup.focus(); } </SCRIPT>\n\n"; simply just doing this would open in a new window as just the image....same as if would right click on the thumb and "view image" // Bolgallery Javascript popup function $bolGalleryPopup = "<!-- BolGallery Javascript popup window function --> <SCRIPT type=\"text/javascript\"> function bolGalleryPopup(imageFile, width, height, title){ var html = '<title>' + title + ' imageFile + ' </title><body></body>'; var popup = window.open('imageFile','scrollbars=yes,menubar=yes,height=768,width=1024,resizable=yes,toolbar=yes,location=yes,status=yes'); popup.document.write(html); } </SCRIPT>\n\n"; Gonna quote you here "I want the image to load in the same page not in any other window seperately " This script is to lower server load and to not load all those large images at the same time on a single page by making and displaying a thumbnail of it. I'm sure you could use ajax to make the fullsize image replace the thumb image on click, but it would cause a lot of havoc with your style on the page. Otherwise the only way to do as you say would be to use hidden dividers and css trickery, which again defeats the purpose because the large images will all still have to load...even if not visible at first. The popup is more like a poor mans way of simulating a lightbox, btw, you could style that. The way they have the script set up, it caches the thumb images and also the display page as html, so delete the following folder and file to see any changes. bolGallery folder within your images folder images_bolGalleryStaticPage.html within your gallery folder Quote Link to comment Share on other sites More sharing options...
sherwinrulzz Posted December 4, 2011 Author Share Posted December 4, 2011 Hi QuickOldCar thanks for your insights you reply is pretty useful and a few thing you said are right about the styling the new window etc .. I wanted to know if there is any php gallery third party option where in the gallery is picked up from a particular folder/directory on a server thumbnails are created accordingly (doesnt have to be in any particular layout) only thanks again QuickOldCar Quote Link to comment Share on other sites More sharing options...
QuickOldCar Posted December 4, 2011 Share Posted December 4, 2011 http://phpthumb.sourceforge.net/ makes thumbs from images and caches them then can just glob() a folder for images to make galleries http://php.net/manual/en/function.glob.php http://net.tutsplus.com/tutorials/php/quick-tip-loop-through-folders-with-phps-glob/ try this one out using jquery http://www.twospy.com/galleriffic/ view each example but these may be what you want http://www.twospy.com/galleriffic/example-2.html http://www.twospy.com/galleriffic/example-5.html#6 there are many premade photo galleries out there http://coppermine-gallery.net/ there has to be hundreds if not thousands of scripts already made related to image galleries look for tutorials or opensource ones Quote Link to comment Share on other sites More sharing options...
sherwinrulzz Posted December 15, 2011 Author Share Posted December 15, 2011 Hi QuickOldCar thank for your inputs and the examples links .. really helped me with my work .. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.