Hi, I am trying to display pictures with a custom field that contains the link to the picture. I tried the following code:
{products_image_url}but this only shows the url instead of the picture.
Any idea how to fix this?
Regards,
Tammo
This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.
The active forums are here.
March 03, 2009 6:42pm
Subscribe [4]#1 / Mar 03, 2009 6:42pm
Hi, I am trying to display pictures with a custom field that contains the link to the picture. I tried the following code:
{products_image_url}but this only shows the url instead of the picture.
Any idea how to fix this?
Regards,
Tammo
#2 / Mar 03, 2009 11:01pm
That is odd… But I think the correct syntax is:
{products_image_url}Try that?
#3 / Mar 04, 2009 10:19am
If you view the source, what exactly is it outputting? Do you see the image tags or is it literally just the URL?
And does the URL point to the right place?
#4 / Mar 04, 2009 10:25am
Could be you have :
Admin->Weblog Administration->Weblog Management->Edit Preferences (Your Weblog)->Weblog Posting Preferences->Automatically turn URLs and email addresses into links?
set to Yes. If you try setting this to No then it might get rid of the problems.
Also I take it that you have the code shown above inside a weblog tag, I guess so anway?
Best wishes,
Mark
#5 / Mar 04, 2009 6:14pm
Thanks all for the help, I checked all and setting Automatically turn URLs and email addresses into links? to No solved the issue.
I don’t however understand why this impacts a link to an image. Here is my code:
{exp:weblog:entries weblog="products" orderby="title" limit="2"}
<h4>{title}</h4>
<p>{products_image}<br />
{products_description}<br />
{products_category}<br />
{products_saleprice}<br />
{products_price}<br />
{products_shipping_cost}<br />
<a href="http://s7d3.scene7.com/is/image/WineEnthusiast/f/w/300/17036.jpg">http://s7d3.scene7.com/is/image/WineEnthusiast/f/w/300/17036.jpg</a><br />
{/exp:weblog:entries}The link to my product page is: page
I have set back the setting to yes to make the issue visible. Also I have put in the link as it is within the custom field and it shows that the link itself works and points to the picture.
Cheers,
Tammo
#6 / Mar 04, 2009 6:42pm
It’s definitely outputting something funky
<img jpg="" w="" f="" wineenthusiast="" image="" is=""com="" >I’ve added a screenshot of the code as it’s not getting displayed correctly even when added between code tags.
#7 / Mar 04, 2009 7:05pm
Thanks all for the help, I checked all and setting Automatically turn URLs and email addresses into links? to No solved the issue.
I don’t however understand why this impacts a link to an image. Here is my code:
I have set back the setting to yes to make the issue visible. Also I have put in the link as it is within the custom field and it shows that the link itself works and points to the picture.
Cheers,
Tammo
Well what is happening here is that ExpressionEngine sees a URL in your custom field and so with that setting set to Yes it converts it into a properly formatted URL including the <a> tag and all. Setting it to No allows you to do whatever you want with it.
The setting can be helpful if you have people posting links in a body for instance and you want them to automatically link but personally myself I always turn that preference off and handle everything in the templates.
Best wishes,
Mark
#8 / Mar 08, 2009 7:00pm
Hi Mark and Sean, thanks for making the issue visible and explaing the cause. It makes sense now. I will follow up on Mark’s advice and turn off Automatically turn URLs and email addresses into links.
Cheers,
Tammo
#9 / Mar 08, 2009 8:02pm
No problem. That’s what I always do. Admitted you won’t want to always do that in all circumstances but for me I always just turn them off as default and then work around it if ever I find that I need to.
Glad it’s all working for you now though.
Best wishes,
Mark