Image Stretch

3 posts by 2 authors in: Forums > CMS Builder
Last Post: June 9, 2008   (RSS)

By Mohaukla - June 9, 2008

I have a page layout that has a series of thumbnails and one main image that is one of the thumbnails.
The thumbnails can be clicked and the main image is set to swap for the clicked image. The problem comes from the height of the main image that loads on the page. The size that the main starting image stays that same even though another thumbnail that is clicked requires different dimensions.

http://www.willmarairservice.com/testphp3.php?1990_Mooney_M20M_TLS_Bravo-11/

Code involved:
<table width="100%" border="0" cellpadding="5" cellspacing="0">
<tr>
<td valign="top"><?php if ($record): ?>
<?php foreach (getUploads($options['tableName'], 'uploads', $record['num']) as $upload): ?>
<?php if ($upload['hasThumbnail']): ?>
<img src="<?php echo $upload['thumbUrlPath'] ?>" width="<?php echo $upload['thumbWidth'] ?>" height="<?php echo $upload['thumbHeight'] ?>" border="0" onmousedown="MM_swapImage('picture','','<?php echo $upload['urlPath'] ?>',1)" />
<!-- <span class="t12_white"><?php echo $upload['info1'] ?></span><br />-->
<?php else: ?>
<a href="<?php echo $upload['urlPath'] ?>">Download <?php echo $upload['info1'] ?></a><br/>
<?php endif ?>
<?php endforeach ?> <br/></td>
</tr>
<tr>
<td valign="top"><img src="<?php echo $upload['urlPath'] ?>" name="picture" width="<?php echo $upload['width'] ?>" height="<?php echo $upload['height'] ?>" id="picture" /></td>
</tr>
</table>


OK the code above is old. I took off the width=" .... and height=" .... tags and it seems to work fine.

New Code:
<table width="100%" border="0" cellpadding="5" cellspacing="0">
<tr>
<td valign="top"><?php if ($record): ?>
<?php foreach (getUploads($options['tableName'], 'uploads', $record['num']) as $upload): ?>
<?php if ($upload['hasThumbnail']): ?>
<img src="<?php echo $upload['thumbUrlPath'] ?>" width="<?php echo $upload['thumbWidth'] ?>" height="<?php echo $upload['thumbHeight'] ?>" border="0" onmousedown="MM_swapImage('picture','','<?php echo $upload['urlPath'] ?>',1)" />
<!-- <span class="t12_white"><?php echo $upload['info1'] ?></span><br />-->
<?php else: ?>
<a href="<?php echo $upload['urlPath'] ?>">Download <?php echo $upload['info1'] ?></a><br/>
<?php endif ?>
<?php endforeach ?> <br/></td>
</tr>
<tr>
<td valign="top"><img src="<?php echo $upload['urlPath'] ?>" name="picture" " id="picture" /></td>
</tr>
</table>


Is there a way to set the sizes needed for each thumbnail clicked into the main image so it will not stretch or squish? Otherwise I will just keep it the way it is now.

Thanks
Michael Moyers



Owner of Just Rite Design Inc. A growing network of professionals in web design, graphic design, flash development, programming, and audio & video productions.



"Due to budget constraints, the Light at the end of the tunnel will be temporarily out!"

Re: [justritedesign] Image Stretch

By Dave - June 9, 2008

Hi Michael,

It doesn't look like the MM_swapImage() function you're using lets you specify height or width when swapping an image. If you could figure out a way to make this work in plain HTML then we could do it in CMS Builder.

Looks like the best way for now might be to just leave the height and width undefined as you have now.
Dave Edis - Senior Developer
interactivetools.com