Displaying single image from group

5 posts by 2 authors in: Forums > CMS Builder
Last Post: November 21, 2008   (RSS)

By Thomas - November 20, 2008

Hi,

I am using CMS v1.23 and I am trying to upload a bunch of pics.

I then want to show a single image (the first one uploaded) at the top of the page and then all the pictures in the form of a gallery.

How do I display just the single first uploaded image in a group.

Many thanks!

Re: [Dave] Displaying single image from group

By Thomas - November 21, 2008

Hi Dave,

Really appreciate your help.
I tried, but I am still kinda stuck though...
So, in it's simplest form my current code is...

<?php foreach ($podcastsRecord['story_image'] as $upload): ?>

<img src="<?php echo $upload['urlPath'] ?>" width="<?php echo $upload['width'] ?>" height="<?php echo $upload['height'] ?>" alt="" />
<?php endforeach ?>


Where exactly do I put the <?php $firstImage = $podcastsRecord['uploads'][0]; ?>

and what else do I have to do to get the first image?

Thank you

Re: [Thomas] Displaying single image from group

By Dave - November 21, 2008

Hi Thomas,

Try this:

<?php $upload = $podcastsRecord['story_image'][0]; ?>
<img src="<?php echo $upload['urlPath'] ?>" width="<?php echo $upload['width'] ?>" height="<?php echo $upload['height'] ?>" alt="" />


<?php foreach ($podcastsRecord['story_image'] as $upload): ?>
<img src="<?php echo $upload['urlPath'] ?>" width="<?php echo $upload['width'] ?>" height="<?php echo $upload['height'] ?>" alt="" />
<?php endforeach ?>


Let me know if that works for you.
Dave Edis - Senior Developer
interactivetools.com

Re: [Dave] Displaying single image from group

By Thomas - November 21, 2008

Hi Dave,

That worked a treat!
Thank you [:)]