Display single upload image

6 posts by 3 authors in: Forums > CMS Builder
Last Post: April 26, 2010   (RSS)

Re: [kkegans] Display single upload image

By Jason - April 26, 2010

Hi,

Even if there is only 1 image uploaded, the code generated by the code generator will still work, even with the If's and ForEach.

Are you running into a specific problem? If so, maybe you can attach the .php file you're working with and a description of the problem, then I can take a look at it for you.

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] Display single upload image

By kkegans - April 26, 2010

Thanks Jason, I just thought there might be a little cleaner and less bloated way of coding to achieve the desired result.
CMSB Rocks!



Thanks,



Kurt

Re: [kkegans] Display single upload image

By Jason - April 26, 2010

Hi,

If you want to post the code you're currently using, I can take a look at cleaning it up a bit for you if you want.

Let me know.
---------------------------------------------------
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: [kkegans] Display single upload image

By Perchpole - April 26, 2010

Hi, KKegans

If you know for sure that you will have an image for every record, and you intend to display the full image - not the thumbnail - you only need this code...

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


Give it a try.

:0)

Perchpole

Re: [Perchpole] Display single upload image

By kkegans - April 26, 2010

Thanks Perchpole,

That is exactly what I was looking for... I didn't see any reason to include a lot of unnecessary code in the web site if it isn't necessary.

Thanks for the solution!

Kurt
CMSB Rocks!



Thanks,



Kurt