Print Page | Close Window

file upload max width size how to??

Printed From: Web Wiz Forums
Category: Web Wiz Web App Support Forums
Forum Name: Web Wiz Forums
Forum Description: Support forum for Web Wiz Forums application.
URL: https://forums.webwiz.net/forum_posts.asp?TID=4350
Printed Date: 03 April 2026 at 9:48am
Software Version: Web Wiz Forums 12.08 - https://www.webwizforums.com


Topic: file upload max width size how to??
Posted By: BrownGhost
Subject: file upload max width size how to??
Date Posted: 19 July 2003 at 9:45am

When users upload pitures to my forum and the piture is lager that the forum it all messes up :(

So i would like to specefy a max width.. like you have whit the max size..

How can i do that...

Thx

        --= = Brown Ghost = =--
--= = International Man of Mystery = =--




Replies:
Posted By: ljamal
Date Posted: 19 July 2003 at 11:14am
http://www.4guysfromrolla.com/webtech/050300-1.shtml - http://www.4guysfromrolla.com/webtech/050300-1.shtml

-------------
L. Jamal Walton

http://www.ljamal.com/" rel="nofollow - L. Jamal Inc : Web/ Print Design and ASP Programming


Posted By: BrownGhost
Date Posted: 19 July 2003 at 8:37pm

thx.. how whould i code that in to the forum??

can you post the change i have to add.. ??

Thx

BG



Posted By: ljamal
Date Posted: 19 July 2003 at 9:52pm
You would add it to the file upload.

If I have time, I'll work on a MOD. I may take a couple days as I have other work to complete right now.

-------------
L. Jamal Walton

http://www.ljamal.com/" rel="nofollow - L. Jamal Inc : Web/ Print Design and ASP Programming


Posted By: fernan82
Date Posted: 19 July 2003 at 10:49pm
Another thing you could do is include this javascript on your header.asp


<script language="Javascript">
     function checkText()
     {
          if (document.images.length > 0)          //Has images, validate sizes
          {
               var imgHeight;
               var imgWidth;
               for (var loop = 0; loop < document.images.length; loop++)
               {
                    if (document.images[loop].name.substring(0,6) == 'chkImg')
                    {
                         imgWidth = document.images[loop].width;
                         imgHeight = document.images[loop].height;
                         
                         if (imgWidth > <% = intAvatarWidth %>)
                         {
                              document.images[loop].width = <% = intAvatarWidth %>;
                              //Proportionalize Height
                              imgHeight = imgHeight / (imgWidth/<% = intAvatarWidth %>);
                              document.images[loop].height = imgHeight;
                         }
                    }
               }
          }
     }
</script>


and then go on functions_format_post.asp and make it add the following to the <img src tags when formatting [IMG] tags: id="chkImg1" name="chkImg2" that will resize all images posted on your forum, not only the uploads but if the user links to an image it'll also resize it... you might also want to add a <br> at the beggining and the end of the image tags otherwise if the user types a long line of text and then the image it'll still brake up your tables...



-------------
FeRnAN
http://www.danasoft.com/">


Posted By: BrownGhost
Date Posted: 21 July 2003 at 2:46am

oki.. what will it rezile the image Width to ??

ware can i specefy the Width Size???

Thx BG



Posted By: BrownGhost
Date Posted: 21 July 2003 at 2:48am

ljamal

A mod sounds real good :))



Posted By: fernan82
Date Posted: 28 August 2003 at 10:39pm
Originally posted by BrownGhost BrownGhost wrote:

oki.. what will it rezile the image Width to ??

ware can i specefy the Width Size???

Thx BG

Sorry I forgot to include that on my post and sorry it took so long ... I just copied that from my forum..., just change the <% = intAvatarWidth %> to the max width you want to allow.



Posted By: BrownGhost
Date Posted: 20 September 2003 at 10:02am

show me in this how to make whith 400 pixels..

<script language="Javascript">
     function checkText()
     {
           if (document.images.length > 0)         &nbs p;//Has images, validate sizes
           {
                var imgHeight;
                var imgWidth;
                for (var loop = 0; loop < document.images.length; loop++)
                 {
                      if (document.images[loop].name.substring(0,6) == 'chkImg')
                      {
                           imgWidth = document.images[loop].width;
                           imgHeight = document.images[loop].height;
                           
                           if (imgWidth > <% = intAvatarWidth %>)
                           {
                                 document.images[loop].width = <% = intAvatarWidth %>;
                                 //Proportionalize Height
                                 imgHeight = imgHeight / (imgWidth/<% = intAvatarWidth %>);
                                 document.images[loop].height = imgHeight;
                            }
                      }
                }
           }
     }
</script>



Posted By: BrownGhost
Date Posted: 20 September 2003 at 10:10am

also her: and then go on functions_format_post.asp and make it add the following to the <img src tags when formatting [IMG] tags: id="chkImg1" name="chkImg2"

Please say line number: and show me code to insert.. compleat:

like replase the on line bla bla whit this: bla bla..

:) thx



Posted By: fernan82
Date Posted: 20 September 2003 at 1:49pm

On my last post I explained how to set the pixels, just replace the <% = intAvatarWidth %> (both of them) with the pixels you want.

I can't tell you the line # on the file cuz mines have been highly modified but look for a line like this:

strTempMessageLink = Replace(strTempMessageLink, "[/IMG]", """>", 1, -1, 1)

and change it to something like this:

strTempMessageLink = Replace(strTempMessageLink, "[/IMG]", """ id='chkImg1' name='chkImg2'>", 1, -1, 1)

also add this line to functions_edit_post.asp on about line 67:

strMessage = Replace(strMessage, " id='chkImg1' name='chkImg2'", "", 1, -1, 1)

That should do it.



Posted By: BrownGhost
Date Posted: 20 September 2003 at 3:50pm

how should this look??

<% = intAvatarWidth %>

????? <% = 400 %> LOL



Posted By: fernan82
Date Posted: 20 September 2003 at 9:09pm

That might work but the way to do it is to replace the whole thing with the 400 like this:

document.images[loop].width = 400

There's two lines with the <% = intAvatarWidth %> so you got to replace them both.



Posted By: JohnnySlotCar
Date Posted: 27 September 2003 at 12:54pm

I've tried this - can't get it to work.  I've

1] added JS code to my header, replacing <&=avatar%> with 390

2] replaced strMessage code in fnc_frmt_post,asp

3] added new strMessage line to fnc_edit_post.asp

No dice.  Any ideas? 



Posted By: fernan82
Date Posted: 27 September 2003 at 5:42pm
my bad, forgot something again, add onLoad="checkText();" to the <body> tag on your header.asp, that should do it.


Posted By: JohnnySlotCar
Date Posted: 27 September 2003 at 6:23pm

Of course!  I should of known that one...

Thanks - good script/mod!

  Johnny



Posted By: JohnnySlotCar
Date Posted: 28 September 2003 at 5:08am

Oops, spoke too soon  Confused  Still can't get it to work...

I did a 'view source' in IE of the page after making all the 4 changes - The OnLoad event is there, the JS is there, still no re-size??  I even dim'ed a intAvatarWidth and set it to 390px in a lame attempt to make this work.  The JS looks solid - method seems sound - yet I can't figure it out...

Bummin'.Cry

Open to any ideas - sorry to be a pest.

BTW, you mentioned putting a <BR> in, where are you adding that?  That's another good idea, as my users aren't hitting return before inserting their images.

I haven't DL'ed v7.5 yet, but it would be nice if Bruce added some support for 'width control' of some sort.Tongue

Johnny
http://www.shoost.com/JohnnySlotCar - http://www.shoost.com/JohnnySlotCar

 

 

 



Posted By: fernan82
Date Posted: 28 September 2003 at 8:23pm

I looked at your forum and posted a test and when I looked at the source the id="chkImg1" name="chkImg2" is not being added to the img tags so that's where the problem is. You'll have to make sure that this is added to the tags when the post is formatted, I'm pretty sure the modifications I posted above to the functions_format_post.asp should've done that but to tell you the truth I haven't tried it, probably some other filter is taking that off but I doubt it as I don't think that can be harmfull at all....

The javascript that I posted works, I know it cause I use it for my avatars and it works just fine so once you get the id="chkImg1" name="chkImg2" to be added to your image tags it will work...

Also this just came to my mind that you'll also have to mod the function that formats the html from the WYSIWYG posts too add that code to the img tags too as it doesn't use forum codes... but I tested on your site using the non-WYSIWYG editor and it didn't added that to the img tags so there's still something wrong...

So I'd say put some work into it (you or anyone else) and see if you can get that to be added to the img tags, i'm sure that after you get it there it'll work... I just posted this as an example for somebody to make the mod, not as a mod.... but if you can't get it to work I'll see if I can get the time to make it a mod sometime this week...



Posted By: JohnnySlotCar
Date Posted: 28 September 2003 at 8:52pm
Everything you're saying makes sense.  I did 'pull' the code from my prod site when I found it not working, so I'm sure that's why it wasn't showing up for you.  The WYSIWYG editor hasn't been mod'ed yet and of course that's what I was using.

I do appreciate all your help - I realize it's 'volunteer work' on your part so I don't want you to think it's not appreciated  Smile

I'll give your WYSIWYG suggestion a try...

Thanks again!

Johnny


Posted By: fernan82
Date Posted: 28 September 2003 at 10:55pm

No problem, I just made it a mod and tested it with the WYSIWYG and non-WYSIWYG editor and it works fine.

to test it go to: http://testing.uznetworkz.com:82/img_width_mod/default.asp - http://testing.uznetworkz.com:82/img_width_mod/default.asp

to download it: http://forums.webwiz.net/forum_posts.asp?TID=6033&PN=1&TPN=1 - http://forums.webwiz.net/forum_posts.asp?TID=6033&a mp;PN=1&TPN=1

Instructions

just open header.asp and set the var intImgWidth to whatever max width you want for your images (by default it's 300 pixels) and then replace the 3 files on the zip file...
be careful with your header.asp as you'll have to copy any code you've added to that file first.

This mod was done with version 7.1 files.

I'll post it on the mod's forum later...



Posted By: JohnnySlotCar
Date Posted: 28 September 2003 at 11:22pm

very, VERY slick!  Thanks a ton - you've made my life a lot easier  ;-)

I looked at a few forum softwares before settling on the WWF and have only had it up about 10 days.  I'm a Jr. to Med. ASP guy and still have a ways to go with understanding WWF.

Anyone out there who needs resizing, this mod works as advertised and helped me tremendously!

Kudos to Fernan82!  Nice work - and - late on a Sunday nite!! Smile

Thanks again!

Johnny



Posted By: fernan82
Date Posted: 28 September 2003 at 11:28pm

You're welcome...

For anyone else I've organized the zip in folders, added a readme file, and posted it here: http://forums.webwiz.net/forum_posts.asp?TID=6033&PN=1&TPN=1 - http://forums.webwiz.net/forum_posts.asp?TID=6033&a mp;PN=1&TPN=1



Posted By: fernan82
Date Posted: 29 September 2003 at 12:18am
Originally posted by JohnnySlotCar JohnnySlotCar wrote:

BTW, you mentioned putting a <BR> in, where are you adding that?  That's another good idea, as my users aren't hitting return before inserting their images.

Sorry I missed that question... you can put the <br> on this line on function_format_post.asp:

strTempMessageLink = Replace(strTempMessageLink, "[/IMG]", """ id='chkImg1' name='chkImg2'>", 1, -1, 1)

change it to:

strTempMessageLink = Replace(strTempMessageLink, "[/IMG]", """ id='chkImg1' name='chkImg2'><br>", 1, -1, 1)

That's line 211....

<edit> might also want to add a <br> at the beggining of the img tag on line 210, change it from:

strTempMessageLink = Replace(strTempMessageLink, ", "<img src=""", 1, -1, 1)

to:

strTempMessageLink = Replace(strTempMessageLink, ", "<br><img src=""", 1, -1, 1)

but thinking about it I would rather add &nbsp; instead of <br>, that way I can't mess your layout and people can still post a small image next to their text....



Posted By: Gemma Fairchild
Date Posted: 29 September 2003 at 3:55am
doh! and I swore I wouldn't mod my forum anymore... great stuff people

-------------
Gemma from http://www.herpetofauna.co.uk - RAUK



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.08 - https://www.webwizforums.com
Copyright ©2001-2026 Web Wiz Ltd. - https://www.webwiz.net