Using thumbs & images in a gallery

8 posts by 6 authors in: Forums > CMS Builder
Last Post: October 17, 2013   (RSS)

By degreesnorth - September 26, 2013

Hi

I've checked the forum, but can't find any solution on how to use the thumbs/images in a gallery (eg. fancybox/lightbox) type of solution.

Problem:
1.  My client wants to be able to generate a number of different galleries on the one page - therefore I have created a multi records called galleries

2.  Each gallery might have anywhere up to 20 images, as they get progressively added.

3.  I don't have a clue how to use the if thumbs/or if image, then add it.

The code at http://www.stpaulsburwood.org.au/galleries.php is

<div id="galleries">
 <h3 id="example-two">Gallery Intro</h3>           
<p>Intro area for client to add info</p>                 
<br />           
<div id="two-fg">             
<div title="First Album">                  
 
<a href="fancygallery/example/images/portfolio/pf_01.jpg" ><img src="fancygallery/example/images/portfolio/thumbs/pf_01.jpg" title="Image Title" /><span>This is a description</span></a>                   
<a href="fancygallery/example/images/portfolio/pf_02.jpg" ></a>                   
<a href="fancygallery/example/images/portfolio/pf_03.jpg" ></a>                   
<a href="fancygallery/example/images/portfolio/pf_04.jpg" ></a>           
<a href="fancygallery/example/images/portfolio/pf_05.jpg" ></a>               
</div>               

<div title="Another Album">                   
<a href="fancygallery/example/images/portfolio/pf_01.jpg" ><img src="fancygallery/example/images/portfolio/thumbs/pf_01.jpg" title="Image Title" /><span>This is a description</span></a>                   
<a href="fancygallery/example/images/portfolio/pf_02.jpg" ></a>                   
<a href="fancygallery/example/images/portfolio/pf_03.jpg" ></a>                   
<a href="fancygallery/example/images/portfolio/pf_04.jpg" ></a>           
<a href="fancygallery/example/images/portfolio/pf_05.jpg" ></a>               
</div>                

<div title="Another Album3">                   
<a href="fancygallery/example/images/portfolio/pf_01.jpg" ><img src="fancygallery/example/images/portfolio/thumbs/pf_01.jpg" title="Image Title" /><span>This is a description</span></a>                   
<a href="fancygallery/example/images/portfolio/pf_02.jpg" ></a>                   
<a href="fancygallery/example/images/portfolio/pf_03.jpg" ></a>                   
<a href="fancygallery/example/images/portfolio/pf_04.jpg" ></a>           
<a href="fancygallery/example/images/portfolio/pf_05.jpg" ></a>               
</div>                

<div title="Another Album4">                   
<a href="fancygallery/example/images/portfolio/pf_01.jpg" ><img src="fancygallery/example/images/portfolio/thumbs/pf_01.jpg" title="Image Title" /><span>This is a description</span></a>                   
<a href="fancygallery/example/images/portfolio/pf_02.jpg" ></a>                   
<a href="fancygallery/example/images/portfolio/pf_03.jpg" ></a>                   
<a href="fancygallery/example/images/portfolio/pf_04.jpg" ></a>           
<a href="fancygallery/example/images/portfolio/pf_05.jpg" ></a>               
</div>  
 
 
  </div> </div>


How can I automate this?  A while back you had provided some code for http://www.owlandthepussycat.com.au/galleries_cp.php which worked great (see below), but I copied this exactly and it doesn't work at all on the new option.


</div>        
</li>        
<?php $record_counter++; ?>
<?php endforeach; ?>

</ul>


</div> <!--gallery end-->

Help please!

By Rewmer - September 27, 2013 - edited: September 27, 2013

Hi,

I use the following "for each" to create the gallery on my site -

I have a single div formatted on the CSS sheet called "gallery" and each thumbnail opens with lightbox effect..

The images are uploads

<?php foreach ($breedings_2013Records as $record): ?>
    
    <div class="gallery"><?php foreach ($record['content'] as $index => $upload): ?>
        <a href="<?php echo $upload['urlPath'] ?>"rel="lightbox"title="<?php echo htmlencode($upload['info1']) ?>">
        <img src="<?php echo $upload['thumbUrlPath'] ?>" width="<?php echo $upload['thumbWidth'] ?>" height="<?php echo $upload['thumbHeight'] ?>" alt="<?php echo htmlencode($upload['info1']) ?>" title="<?php echo htmlencode($upload['info1']) ?>" />
        </a>
   <?php echo htmlencode($record['title']) ?>
        <?php endforeach ?></div>
     <?php endforeach ?>

Hope this helps

Andy

By gregThomas - September 27, 2013

Hi, 

Would it be possible to post or attach your current code for me?

I think you need to use a getRecords function to retrieve all of your gallery records, and then cycle through them using two foreach loops as suggested by  Rewmer.

Thanks!

Greg

Greg Thomas







PHP Programmer - interactivetools.com

By degreesnorth - October 8, 2013

Hi Greg

I appreciate the other comments on setting up a new lightbox, but this one works really well on another site, however not reading the load location (ie, it's looking for http://uploads/thumb/bell2.jpg, rather than the correct upload location.  The page is at http://www.stpaulsburwood.org.au/galleries.php and I have attached the code.

Attachments:

galleries.php 8K

By degreesnorth - October 15, 2013

Hi Greg

Just checking to see whether you've had a chance to look at this?  It's getting rather urgent.

Thanks

By mizrahi - October 16, 2013

in the generated code for the img srcs, it is showing "//uploads/...", when it should say "/cmsAdmin/uploads/..."

I believe this is the result of incorrect setting in your cms. 

If you go to Admin > General Settings, what do you have in the boxes for Upload Directory and for Upload folder URL?

By Chris - October 17, 2013

Hi degreesnorth,

I spent a while trying to fiddle with the JavaScript to try to get fancygallery to run on your HTML, but I wasn't able to get accomplish anything of note. There are two JavaScript errors coming up for me in Chrome's Developer Tools which could be masking a problem.

I'm afraid we can't debug third-party JavaScript libraries as part of our free support.

I suggest you try tackling this problem in two stages: first, try getting a gallery working using the same lightbox that Rewmer and gkornbluth are using and make sure you don't have any JavaScript errors on the page. Many more community members will be able to help you debug your site if you use more-standard JavaScript libraries.

Once you've got that working, switch over to use your preferred lightbox (i.e. fancygallery).

I hope this helps!

All the best,
Chris