Gossamer Forum
Home : Products : Gossamer Links : Version 1.x :

Display the attached image in the Links?

Quote Reply
Display the attached image in the Links?
Guys,

I have setup my Links Sql to accept file attachements, everything seems to work nearly perfect :-)

I can't output the Images in the html pages, I have tried this but it seems not to work:

<%if image%> <img src="<%attach_dir%>/<%image%>"><%endif%><%ifnot image%> <img src="<%attach_dir%>/default.jpg"><%endif%>

I have my Links default setup, Any ideas about how the correct code should be?

Best, Tomas

Quote Reply
Re: Display the attached image in the Links? In reply to
What is the error-message?

If it is: tag ... not found you need to pass tag to the template.

If the pic is not shown, proofe the path

Robert

Quote Reply
Re: Display the attached image in the Links? In reply to
Dear, Robert

Thanks for your reply.

The error message is: Unkown Tag: image

My Link.html file look like this:
<ul><li><a class="link" href="<%db_cgi_url%>/jump.cgi?ID=<%ID%>"><%Title%></a>

<%if Description%>
<span class="descript">- <%Description%></span>
<%endif%>

<%if isNew%>
<small><sup class="new">new</sup></small>
<%endif%>

<%if isChanged%>
<small><sup class="new">update</sup></small>
<%endif%>

<%if isPopular%>
<small><sup class="pop">pop</sup></small>
<%endif%>

<small class="date">(Added: <%Add_Date%> Hits: <%Hits%> Rating: <%Rating%> Votes: <%Votes%>) <a href="<%db_cgi_url%>/rate.cgi?ID=<%ID%>">Rate It</a></small>

<%if isEditor%>
<small class="date"> | <a href="<%db_cgi_url%>/maintain.cgi?modify_form=1&modify=<%ID%>">Edit</a> | <a href="<%db_cgi_url%>/maintain.cgi?delete_form=1&delete=<%ID%>">Delete</a></small>
<%endif%>
</ul><%image%>

< If it is: tag ... not found you need to pass tag to the template.

Which template do I need to add it to, and how? Is there any files who need to be edit manually except link.html to have the images display work.

Best, Thomas


Quote Reply
Re: Display the attached image in the Links? In reply to
You need to pass the image tag via the sub site_html_link routine in the HTML_Templates.pm.

Is the name of your image field called image?

Regards,

Eliot

Quote Reply
Re: Display the attached image in the Links? In reply to
Dear, Elliot thanks for your reply.

I'm not sure about the name for the image field, my database is default setup without any modification.

If possible can you please give me a short example
how the sub site_html_link routine in the HTML_Templates.pm should look like.

Thanx in advance.

Best, Tomas



Quote Reply
Re: Display the attached image in the Links? In reply to
Hmm, you cant use any tag without defining it; ways to do:
If you save your pics with the ID and know you have only gif (or jpg) then you could show the pics with:

-%image_url%-/-%ID%-.gif

You should have set -%image_url%- somewhere, maybe as Global in html_templates (?)

My way: I have set up inside links-table a new field called Logo as enum('.gif','.jpg')
When someone adds a link and uploads a file, i test if itīs a .gif or .jpg (.GIF or .JPG or .JPEG or .jpeg)
When i validate the file is saved to ID.gif (when .gif or .GIF) or to ID.JPG (when jpg,JPG,JPEG,jpeg)
I must manually do the change of my field Logo to .jpg or .gif.

Inside the links.html it goes:

-img src="http://gaga/logos/-%ID%-.-%Logo%-

I would work on this the next hours, maybe i find a better solution ...

One thing you should remark: You could only use a tag inside a template if it will be passed tru. Everytime you add a new field in links-table you could use the tag=Field_Name (case-sensitiv!); the same to category-table.

Sometimes you need some more coding (e.g. if you want the category-description not in sub-category but in category.html)
or if you need a field-value inside the perl-code not in the template.
Ask if you need something like this.

Maybe in some hours more ...

Robert