Display single upload image

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

By kkegans - April 26, 2010

I am using upload to allow the client to add a company logo to a page in a single record editor. The upload is limited to one image being upploaded.

What is the proper way to display the upload image, when there is no need for the ForEach, If, ElseIf, Else?.
CMSB Rocks!
Thanks,
Kurt

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