Gossamer Forum
Home : Products : Gossamer Forum : Development, Plugins and Globals :

limit visible size of attachments in posts

Quote Reply
limit visible size of attachments in posts
I would like to limit the size of attachments in posts to, say, 120x120 pixels.

Just the way it works for the user-icons - they are automatically shrunk. I see how the user-icons are shrunk, in the template.

But I cannot see how to shrink the attachments in posts. The posts are called by <%post_message%>.
Do I have to go into the perl, if so, where and how?

Thanks!
Quote Reply
Re: [tora] limit visible size of attachments in posts In reply to
I do mine in CSS

.Upload img {
border: 3px double #000000;
max-width:200px;
max-height:150px;
width: expression(this.width > 150 ? 150: true);
}


Sandra Roussel
Chonsa Group Design - Fresh Start Housing
Quote Reply
Re: [SandraR] limit visible size of attachments in posts In reply to
I put that code into the css file.

So now "upload" is the class of an img tag, right?

In what template is the img tag? Sorry, I don't quite yet get how you do it.

Thanks for your help.Smile

Tora
Quote Reply
Re: [tora] limit visible size of attachments in posts In reply to
Sorry for the delay in a reply, I missed this email some how.

this is how I do mine in link.html:

<%if Upload_Image%><div class="Upload"><img src="<%imageurl('Upload_Image')%>" alt="<%Description%> -<%Title%>-"></a></div><%endif%>


Sandra Roussel
Chonsa Group Design - Fresh Start Housing
Quote Reply
Re: [SandraR] limit visible size of attachments in posts In reply to
link.html is in links, not forum, isn't it?

I need a solution that works in forum. Can you still help me?

Thanks so much!!
Quote Reply
Re: [tora] limit visible size of attachments in posts In reply to
The concept is still the same; wherever the images are located in your template is where you want to add the code.


Sandra Roussel
Chonsa Group Design - Fresh Start Housing
Quote Reply
Re: [SandraR] limit visible size of attachments in posts In reply to
The images are not in the template - all of the post is generated from the perl, and appears in the template only through <%post_message%>.
Quote Reply
Re: [tora] limit visible size of attachments in posts In reply to
Dependent on your design it can still work

Using CSS

img {
max-width:200px;
max-height:150px;
width: expression(this.width > 150 ? 150: true);
}


That will affect every single image on your forum no matter the image, most images on a website are not larger than the specified size above except maybe a logo.

Say you only have a few buttons and a logo that are no larger than 199x149 you can use the image CSS change.

If have banners that are 468x60 - it will shrink them to your max image size of 200x150.

Does this help?


Sandra Roussel
Chonsa Group Design - Fresh Start Housing
Quote Reply
Re: [SandraR] limit visible size of attachments in posts In reply to
Thanks!
Now almost midnight here in Rome - I have to run the tests tomorrow, and get back to you then.
Thanks again.
Quote Reply
Re: [SandraR] limit visible size of attachments in posts In reply to
It works beautifully - thank you so much!
Quote Reply
Re: [tora] limit visible size of attachments in posts In reply to
:)