Web Wiz - Solar Powered Eco Web Hosting

  New Posts New Posts RSS Feed - MOD: Placing restrictions on signature image size
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

MOD: Placing restrictions on signature image size

 Post Reply Post Reply
Author
Imperator View Drop Down
Newbie
Newbie


Joined: 02 October 2004
Status: Offline
Points: 39
Post Options Post Options   Thanks (0) Thanks(0)   Quote Imperator Quote  Post ReplyReply Direct Link To This Post Topic: MOD: Placing restrictions on signature image size
    Posted: 09 August 2006 at 4:53pm
This page will explain how to...
  • Place limits on the maximum pixel dimensions of the signature so that images that are too large in dimensions will be automatically cropped. (Part I)

  • Filter out images out of signature based on the file size of the images. (Part 2)
Part I Limiting Signature Dimensions

If a user has a signature that is too large in dimensions, it can mess up the screen. The ideal solution would be to create a div container for the signature so that the div stretches until a set limited, after which it stops stretching and crops the signature. In V8.x of webwizforum, a "max-height" property was added to the div container of the sig. However, "max-height" is not a functional property in IE, and at least in version 8.01 which I use, this error has not been fixed. In order to implement max-height in IE, a workaround has to be used.

How to implement the MOD:
Open the stylesheet of the mod. Most likely, this will be css_styles/default_style.css. Insert or modify the existing code to the lines shown in red and blue into the .msgSignature.


Code in css_styles/default_style.css that needs to be inserted/modified
-----------------------------------------------------------------------------------------
.msgSignature{
    max-height: 160px;
    width: 600px;
    height:expression(this.scrollHeight > 160? "160px" : "auto" );
}
-----------------------------------------------------------------------------------------


Result: All text/images beyond 600x160 will be cropped. The signature will automatically shrink to fit if the signature is smaller than 600x160.

NOTE: In this example, only the vertical height is dynamically controlled. In order to dynamically control the width, a similar expression needs to be replicated for the width. However, in most cases, a fixed horizontal width is good enough because it is not necessary to dynamically "shrink" the width, unlike with the height.

Summary of the code:
Since IE  does not recognize the "max-height" property, a workaround involving "expression and this.scrollHeight" must be used. This line, shown in blue has essentially the same effect as "max-height," but is recognized by IE.

To customize the maximum height of the, change 160 to whatever you want it to be. To customize the maximum width, change "width: 600px" to whatever you want it to be.

To remove the scrollbars on the signature, line 696 in functions/format_post.asp has to be modified. Change the overflow from "auto" to "hidden" as shown in red.


Line 696 in functions/format_post.asp that needs to be inserted/modified
-----------------------------------------------------------------------------------------
    vbCrLf & "    <div class=""msgSignature"" style=""float:left; overflow:hidden;"">" & _
-----------------------------------------------------------------------------------------



Part II Limiting the file sizes of images in signatures

While the above code would limit the dimensional size of signatures, it doesn't limit the file size of images in the signature. To do this, a more complicated code needs to be written.

How to implement the MOD:
Insert the additional code into register.asp as shown:


Code in register.asp, showing starting from line 323. Insert only the code in blue/red in the exact location as shown. Do not modify anything else.
------------------------------------------------------------------------------------------
    '******************************************
    '***  Read in member details from form    ***
    '******************************************

        'Read in the users details from the form
        If strMode = "new" Then strUsername = Trim(Mid(Request.Form("name"), 1, 15))



        'If part number = 0 (all) or part 1 (reg details) then run this code
        If intUpdatePartNumber = 0 OR intUpdatePartNumber = 1 Then

            strPassword = LCase(Trim(Mid(Request.Form("password"), 1, 15)))
            strConfirmPassword = LCase(Trim(Mid(Request.Form("oldPass"), 1, 15)))
            strEmail = Trim(Mid(Request.Form("email"), 1, 60))
       End If



        'If part number = 0 (all) or part 2 (profile details) then run this code
        If intUpdatePartNumber = 0 OR intUpdatePartNumber = 2 Then

            strRealName = Trim(Mid(Request.Form("realName"), 1, 27))
            strLocation = Trim(Mid(Request.Form("location"), 1, 40))
                strTitle = Cint(Request.Form("title"))
            strHomepage = Trim(Mid(Request.Form("homepage"), 1, 48))
            strSignature = Mid(Request.Form("signature"), 1, 200)
                '*****BEGIN Signature Image File Size LIMITATION CODE
    dim positionIMG
    dim StrSignatureExamine
    dim SigArrayCount
    dim SigImgArray()
    dim SubStr1
    dim SubStr2
    SigArrayCount = 0
    StrSignature = Replace(StrSignature,"img]","IMG]")
    StrSignature = Replace(StrSignature,"Img]","IMG]")
    StrSignature = Replace(StrSignature,"IMg]","IMG]")
    StrSignature = Replace(StrSignature,"ImG]","IMG]")
    StrSignature = Replace(StrSignature,"imG]","IMG]")
    StrSignature = Replace(StrSignature,"iMG]","IMG]")
    StrSignature = Replace(StrSignature,"iMg]","IMG]")
    StrSignatureExamine = StrSignature
    Do While inStr(StrSignatureExamine,"") > 0
        ReDim Preserve SigImgArray(SigArrayCount)
        SubStr1 = inStr(StrSignatureExamine,"         SubStr2 = inStr(StrSignatureExamine,"">")
        SigImgArray(SigArrayCount) = Mid(StrSignatureExamine,Sub
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.07
Copyright ©2001-2024 Web Wiz Ltd.


Become a Fan on Facebook Follow us on X Connect with us on LinkedIn Web Wiz Blogs
About Web Wiz | Contact Web Wiz | Terms & Conditions | Cookies | Privacy Policy

Web Wiz is the trading name of Web Wiz Ltd. Company registration No. 05977755. Registered in England and Wales.
Registered office: Web Wiz Ltd, Unit 18, The Glenmore Centre, Fancy Road, Poole, Dorset, BH12 4FB, UK.

Prices exclude VAT unless otherwise stated. VAT No. GB988999105 - $, € prices shown as a guideline only.

Copyright ©2001-2024 Web Wiz Ltd. All rights reserved.