Adding links to image uploads

4 posts by 2 authors in: Forums > CMS Builder
Last Post: April 1, 2009   (RSS)

By lterenzi - April 1, 2009

Hey guys -

I have an image uploader set up and I want my client to be able to link those uploaded images to pages. How do I enter a link and have it attach itself to that image?

I did some searches and I think it has to do with the custom fields. If I have them enter a URL into a custom field [info1] how do i tell that to be the link for that image?

Thanks!

Lenny
Best,
Lenny

Hey Monkey! Design
graphic design • web development • blog
--
lenny@heymonkeydesign.com
919•279•3301
--
web: www.heymonkeydesign.com
twitter: @heymonkeydesign

Re: [lterenzi] Adding links to image uploads

By ross - April 1, 2009

Hi Lenny

Thanks for posting!

If you are already entering the URL into info1 you are really close to getting it going :).

On your tempate, in the forloop for your upload, you can access info1 like this:

$upload['info1']

So a url would look something like this:

<a href="<?php echo $upload['info1']; ?>"><img></a>

Just make sure the $upload part is correct. You might have changed it on your template.

Let me know if this makes sense and if it gets things going.

Thanks!
-----------------------------------------------------------
Cheers,
Ross Fairbairn - Consulting
consulting@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: http://www.interactivetools.com/consulting/

Re: [ross] Adding links to image uploads

By lterenzi - April 1, 2009

Hey Ross!

That almost got me there... Every image now as a link even if I didn't specify a link.

<?php elseif ($upload['isImage']): ?><a href="<?php echo $upload['info1'] ?>"><img src="<?php echo $upload['urlPath'] ?>" width="<?php echo $upload['width'] ?>" height="<?php echo $upload['height'] ?>" alt="" /></a>

It makes sense why it is doing that. I am basically telling it to to wrap everything with an ahref tag. How do I tell it to ignore that if there is no link?

Thanks!
Best,
Lenny

Hey Monkey! Design
graphic design • web development • blog
--
lenny@heymonkeydesign.com
919•279•3301
--
web: www.heymonkeydesign.com
twitter: @heymonkeydesign