Help with linking thumbnails to full sized images

2 posts by 2 authors in: Forums > CMS Builder
Last Post: July 12, 2008   (RSS)

By gkornbluth - July 12, 2008

I've set up an image gallery page and would like to be able to link the thumbnails that are displayed to the larger uploaded images.

I can't seem to get this to work. Hope someone can help.

The images were uploaded with the following parameters:

Maximum uploads: 1 file
Maximum upload size: 1000 Kbytes
Resize images larger than: 800 height 600 width
Create image thumbnails: 275 height 275 width

I'm assuming that this would create a thumbnail that's no larger than 275px by 275px, and a large image that's no larger than 800px by 600px.


The following code is a sample of what is on the web page:


<?php foreach ($gallery_2003Record['image_1'] 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 ?>
<br />
<?php echo $upload['info1']; ?><br />
<?php echo $upload['info2']; ?><br />
<br />
</span>
The first CMS Builder reference book is now available on-line!







Take advantage of a free 3 month trial subscription, only for CMSB users, at: http://www.thecmsbcookbook.com/trial.php

Re: [gkornbluth] Help with linking thumbnails to full sized images

By Jake - July 12, 2008

Hi Jerry,

Try using this code - it should do the trick:

<?php foreach ($gallery_2003Record['image_1'] as $upload): ?>
<?php if ($upload['hasThumbnail']): ?>
<a href="<?php echo $upload['urlPath'] ?>"><img src="<?php echo $upload['thumbUrlPath'] ?>" width="<?php echo $upload['thumbWidth'] ?>" height="<?php echo $upload['thumbHeight'] ?>" alt="" /></a><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 ?>
<br />
<?php echo $upload['info1']; ?><br />
<?php echo $upload['info2']; ?><br />
<br />
</span>


Your assumptions about the image dimension restrictions are correct. [:)]
-----------------------------------------------------------
Cheers,
Jake Marvin - Product Specialist
support@interactivetools.com

Hire me!
Save time by getting our experts to help with your project. Template changes, advanced features, full integration, whatever you need. Whether you need one hour or fifty, get it done fast with Priority Consulting.