Welcome Guest [Log In] [Register]
We hope you enjoy your visit.

You're currently viewing our forum as a guest. This means you are limited to certain areas of the board and there are some features you can't use. If you join our community, you'll be able to access member-only sections, and use many member-only features such as customizing your profile, sending personal messages, and voting in polls. Registration is simple, fast, and completely free.


Join our community!


If you're already a member please log in to your account to access all of our features:

Username:   Password:
Add Reply
Posted images
Topic Started: Sep 1 2008, 11:42 AM (553 Views)
CaptainTsubasa
Member Avatar
Member
 *   *   *  
Hi there.

Is there a code for constrain the size of the posted images so that their dimensions do not deform the board?? I mean, to automatically modify the size of the posted image, so it doesnt get bigger than the size of the board, even if the original size of the picture actually is.

Thanks
Offline Profile Quote Post Goto Top
 
Ryan
Member
 *   *   *   *   *   *   *   *   *  
There are a few ways you can do this (depending on which way your users post images):

If your users are posting an image using the [IMG] tag, you can restrict the size of the image they post by adding the following line of code to your forum's style sheet, from the Manage Style Sheet section of your admin control panel:
Quote:
 
.post1 img {
max-width: 500px;
max-height: 500px;
}
.post2 img {
max-width: 500px;
max-height: 500px;
}
Simply change the pixel values in red to the desired size. Any images that are posted that are larger than your max values will be automatically resized.

If your users are uploading their images and attaching them to their posts, you can choose to have them displayed as thumbnails of any size you wish. The option to do this is located in your admin control panel in the Topics, Posts & Polls section. You'll be looking for the "Show uploaded images in post?" option. Here you can set the max size of the thumbnail or choose to not display the images at all.

I hope this helps!

Ryan
Offline Profile Quote Post Goto Top
 
CaptainTsubasa
Member Avatar
Member
 *   *   *  
Didnt work........................... What Im doing wrong???
Offline Profile Quote Post Goto Top
 
cvn-tv-dip
Member
 *   *   *   *   *   *  
Can you post what changes you made?
Offline Profile Quote Post Goto Top
 
Viral.
Member Avatar
Member
 *   *   *   *   *   *  
What browser are you using?
Offline Profile Quote Post Goto Top
 
CaptainTsubasa
Member Avatar
Member
 *   *   *  
Sure. This is the pertinent part of the ccs:

.post1 { background-color: #9a9a9a}
.post1 img { max-width: 615px; max-height: 700px; }
.post2 { background-color: #9a9a9a}
.post2 img { max-width: 615px; max-height: 700px; }
.postlinksbar { background-color:#C1C4C8;padding:7px;margin-top:1px;font-size:10px; }


Im using IE 6.0 and also the last IE, for windows vista.

Thanks
Offline Profile Quote Post Goto Top
 
Cory
Member Avatar
Member
 *   *   *   *   *   *   *   *   *  
IE doesn't support the max-width and max-height properties.

Give the following code a shot (which appears to work in IE7).

Admin CP Posted Image Skinning & Styles Posted Image Board Wrappers Posted Image Footer
Quote:
 
<script>
function resizeimgs() {
var a = document.getElementsByTagName('img');
var maxwidth = 200;

for(x=0;x<a.length;x++){
if(a[x].width > maxwidth) {
a[x].setAttribute('onclick','if(this.width == ' + maxwidth + '){this.width = ' + a[x].width + ';}else{this.width=' + maxwidth + ';}');
a[x].setAttribute('onload','resizeimgs();');
a[x].setAttribute('title','Click to expand/contract');
a[x].width = maxwidth;
a[x].outerHTML = a[x].outerHTML;
}
}
}
resizeimgs();document.onload=resizeimgs();
</script>
Offline Profile Quote Post Goto Top
 
CaptainTsubasa
Member Avatar
Member
 *   *   *  
Mmm... didnt work....................
Offline Profile Quote Post Goto Top
 
Lone Stranger (S)
Member Avatar
Member
 *   *   *   *   *  
If you don't mind all of the images being the same height and width, then you could always just take out the "max-" part of the CSS code.
Offline Profile Quote Post Goto Top
 
Cory
Member Avatar
Member
 *   *   *   *   *   *   *   *   *  
There's a chance it might not work in IE6, but it may actually be caused by one of your other codes. Please post your board wrappers.
Offline Profile Quote Post Goto Top
 
1 user reading this topic (1 Guest and 0 Anonymous)
« Previous Topic · zIFBoards Support & Galleries · Next Topic »
Add Reply