Image List

7 posts by 2 authors in: Forums > CMS Builder
Last Post: January 31, 2011   (RSS)

By KCMedia - January 30, 2011

Hi

i have this image gallery that i want to show and i am having a couple of issues getting it to work.
can someone point me in the right direction please.

here is the code that works now

<img src="images/pic1.png" id="pic" alt="">
<ul id="thumbs">
<li><a href="images/pic1.png"><img src="images/thumb1.png" alt=""></a></li>
<li><a href="images/pic2.png"><img src="images/thumb2.png" alt=""></a></li>
<li><a href="images/pic3.png"><img src="images/thumb3.png" alt=""></a></li>
<li><a href="images/pic4.png"><img src="images/thumb4.png" alt=""></a></li>
<li><a href="images/pic5.png"><img src="images/thumb5.png" alt=""></a></li>
<li><a href="images/pic6.png"><img src="images/thumb6.png" alt=""></a></li>
</ul>

and here is the code from cms builder how can i get it to work.

<!-- STEP2: Display Records (Paste this where you want your records to be listed) -->
<h1>Gallery - List Page Viewer</h1>
<?php foreach ($galleryRecords as $record): ?>
Record Number: <?php echo $record['num'] ?><br/>
_link : <a href="<?php echo $record['_link'] ?>"><?php echo $record['_link'] ?></a><br/>


<!-- STEP 2a: Display Uploads for field 'image' (Paste this anywhere inside STEP2 to display uploads) -->
<!-- Upload Fields: num, createdTime, tableName, fieldName, recordNum, preSaveTempId, filePath, filename, extension, thumbFilePath, isImage, hasThumbnail, urlPath, width, height, thumbUrlPath, thumbWidth, thumbHeight, info1, info2, info3, info4, info5 -->
<?php foreach ($record['image'] as $upload): ?>
<?php if ($upload['hasThumbnail']): ?>
<img src="<?php echo $upload['thumbUrlPath'] ?>" width="<?php echo $upload['thumbWidth'] ?>" height="<?php echo $upload['thumbHeight'] ?>" alt="" /><br/>

<?php elseif ($upload['isImage']): ?>
<img src="<?php echo $upload['urlPath'] ?>" width="<?php echo $upload['width'] ?>" height="<?php echo $upload['height'] ?>" alt="" /><br/>

<?php else: ?>
<a href="<?php echo $upload['urlPath'] ?>">Download <?php echo $upload['filename'] ?></a><br/>

<?php endif ?>
<?php endforeach ?>
<!-- STEP2a: /Display Uploads -->


<hr/>
<?php endforeach ?>

<?php if (!$galleryRecords): ?>
No records were found!<br/><br/>
<?php endif ?>
<!-- /STEP2: Display Records -->
Thanks



Craig

KC Media Solutions

www.kcmedia.biz

Re: [kcmedia] Image List

By Jason - January 31, 2011

Hi,

The default image output code that the code generator produces just displays all of images in a record but it doesn't add any extra formatting that the gallery script may require.

Try something like this:

<?php if($record['image']): ?>
<?php $firstImage = $record['image'][0]; ?>
<img src="<?php echo $firstImage['urlPath'];?>" id="pic" alt="" />

<ul id="thumbs">
<?php foreach($record['image'] as $image): ?>
<li><a href="<?php echo $image['urlPath'];?>"><img src="<?php echo $image['thumbUrlPath'];?>" alt="" /></a></li>
<?php endforeach ?>
</ul>
<?php endif ?>

---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/

Re: [Jason] Image List

By KCMedia - January 31, 2011

Hi Jason

i tried that but didnt work.

here is the link to the site

www.hotlocks.net.au/index.php

it is under the gallery link and also find attached the page for the current code.

also what do you think of the site so far?
Thanks



Craig

KC Media Solutions

www.kcmedia.biz
Attachments:

index_033.php 15K

Re: [kcmedia] Image List

By Jason - January 31, 2011

Hi,

The code I provided is for inside the loop outputting your gallery records. Try this:

<h2>gallery</h2>

<?php foreach($galleryRecords as $record): ?>
<?php if($record['image']): ?>
<?php $firstImage = $record['image'][0]; ?>
<img src="<?php echo $firstImage['urlPath'];?>" id="pic" alt="" />

<ul id="thumbs">
<?php foreach($record['image'] as $image): ?>
<li><a href="<?php echo $image['urlPath'];?>"><img src="<?php echo $image['thumbUrlPath'];?>" alt="" /></a></li>
<?php endforeach ?>
</ul>
<?php endif ?>

<?php endforeach ?>

</div>


Hope this helps.
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/

Re: [Jason] Image List

By KCMedia - January 31, 2011

Hi Jason

no didnt really work have a look at the page now.
Thanks



Craig

KC Media Solutions

www.kcmedia.biz

Re: [kcmedia] Image List

By Jason - January 31, 2011

Hi Craig,

The images are outputting properly. I think the issue you're having is that you set the gallery section up as a multi-record section and then uploaded one image for each record. What you're probably looking for is to have 1 record with all the images uploaded to that one record. That way you'll get one main image and a list of thumbnails.

Give that a try.
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/