JWS
07 Mar 2001, 02:49
Okay, I don't know about the rest of you, but I was getting a little tired of images being WAY too huge in posts and blowing away the formatting of the tables. So, after collecting some code here and there and hacking the functions.php file we have the following hack. Please note that I'm not claiming for this to be the best code in the world, but after a couple of hours of debugging, it'll have to do -- you may optimize at will!
This hack will allow you to set the maximum width that you want an image to be and any pic in a signature or a post will be automatically sized to fit within this parameter. This does NOT resize the image graphic, but rather just figures out what the maximum "height" and "width" parameters should be on the IMG tag when displaying it. The images will still take as long to download since its the same larger graphic, but they'll be sized correctly at least.
This will only work on vBcode IMG tags!
Okay, here are the steps:
In function.php, in the bbcodeparse2() function, look for the following code:
Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------
Replace this code with:
Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------
Now, at the end of functions.php, add the following:
Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------
Note that in the function called imagereduction(), there is a setting for the "picsize". That should actually be the maximum width that you want for your pictures to be. The point of the imagereduction() function is to determine the proportions correctly based on the image's size.
Also note that both of these functions are someone else's and the GetURLImage() function will not be necessary with PHP 4.0.5 comes out because the PHP GetImageSize() function will accept URLs.
This hack will allow you to set the maximum width that you want an image to be and any pic in a signature or a post will be automatically sized to fit within this parameter. This does NOT resize the image graphic, but rather just figures out what the maximum "height" and "width" parameters should be on the IMG tag when displaying it. The images will still take as long to download since its the same larger graphic, but they'll be sized correctly at least.
This will only work on vBcode IMG tags!
Okay, here are the steps:
In function.php, in the bbcodeparse2() function, look for the following code:
Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------
Replace this code with:
Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------
Now, at the end of functions.php, add the following:
Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------
Note that in the function called imagereduction(), there is a setting for the "picsize". That should actually be the maximum width that you want for your pictures to be. The point of the imagereduction() function is to determine the proportions correctly based on the image's size.
Also note that both of these functions are someone else's and the GetURLImage() function will not be necessary with PHP 4.0.5 comes out because the PHP GetImageSize() function will accept URLs.