1

(5 replies, posted in PunBB 1.3 troubleshooting)

Sorry if I was unclear about this, but the horizontal scrollbar is present even when it shouldn't actually be there.  See, when scrolling it to the right, it scrolls to nothing but a blank background.  That's why it caught my eye.

http://i.ohok.nl/i/punbb-on-touch.jpg

Sorry for the bad quality picture, but that's with the horizontal scrollbar moved halfway.  I could scroll it all the way to the right and nothing but a white background would be visible.  It's not terribly cumbersome or anything like that, but it does look a little weird. Hope this helps anyway.

2

(5 replies, posted in PunBB 1.3 troubleshooting)

I just had a quick look at pundemo.org on my iPod Touch, but it appears to be ok.  Font sizes are a little weird here and there (the forum title is too small, for example), but Safari Mobile appears to do that with many websites for some reason.  Two things really stood out for me: a large horizontal scrollbar on every page, and the navigation crumbs not wrapping.

In case it matters: Mozilla/5.0 (iPod; U; CPU like Mac OS X; nl-nl) AppleWebKit/420.1 (KHTML, like Gecko) Version/3.0 Mobile/4A93 Safari/419.3

##
##        Mod title:  Automatically resize uploaded avatars
##
##      Mod version:  1.0
##   Works on PunBB:  1.2.*
##     Release date:  2007-08-23
##           Author:  thame^
##
##      Description:  PunBB's default behaviour is to reject any uploaded avatar
##                    image whose dimensions exceed those set in the options.
##                    Using this mod, PunBB will attempt to automatically resize
##                    those images to the maximum allowed dimensions, maintaining
##                    their aspect ratio. If the file size of the _resized image_
##                    is larger than allowed by the options, the upload will still
##                    be rejected.
##
##   Affected files:  profile.php
##
##       Affects DB:  No
##
##            Notes:  This mod requires the GD image library, including support
##                    for at least JPEG (GIF and PNG are also recommended). If
##                    your copy of PHP is compiled without GD support (or lacks
##                    support for the uploaded image type), the mod will silently
##                    revert to the default PunBB behaviour. Visit
##                    http://php.net/gd for more information about the GD image
##                    library.
##
##       DISCLAIMER:  Please note that "mods" are not officially supported by
##                    PunBB. Installation of this modification is done at your
##                    own risk. Backup your forum database and any and all
##                    applicable files before proceeding.
##

Download from punres

As mentioned in these threads.  Special thanks to Koos for helping me turn this into a proper mod.

MattF wrote:

Changing imagecopyresized to imagecopyresampled *may* also help.

This is the correct answer!  I don't know what I was thinking when I used imagecopyresized back then, but changing it to imagecopyresampled will definitely improve the quality.  I've updated the code on my site (coloured too).  Sorry about that!

I should probably turn all that into a mod, but I'm lazy and I don't know how.  If anyone's willing to do it for me, please do.

EDIT: This was turned into a proper mod some time ago.  Please refer to http://punbb.org/forums/viewtopic.php?id=16883

5

(12 replies, posted in Feature requests)

Smartys wrote:

The issue is that then GD is necessary wink

The code I linked to in the other thread scales down gracefully if GD isn't installed on the webhost: it simply reverts to PunBB's original behaviour, rejecting the image if it's too large.  I don't see why something like it can't be included with PunBB 'out of the box', though to be fair there would have to be an option to disable the automatic resizing for people who have GD installed but don't wish for the resizing to happen.  Still, not too big a deal.

Hi Peter, glad to hear my modifcation's working out for you.. sort of.

Your situation is a little unique, since you have profile.php outside of the PUN_ROOT.  The 'Bad HTTP_REFERER' errors you're getting when attempting to delete an avatar would've occured with or without my changes to profile.php -- it has to do with the 'confirm_referrer('profile.php');' line.  Though I can't help you with that specific error, I think I may know how to fix the other errors.

The other errors you're getting is because the $pun_config['o_avatars_dir'] config variable ('Avatar upload directory') is relative to the PUN_ROOT.  Since your profile.php is outside that, it's obviously not going to work.  You've already started off on the right foot by editing a few instances of $pun_config['o_avatars_dir'], but the real solution would be to replace ALL instances of it to 'PUN_ROOT.$pun_config['o_avatars_dir']'.  Or, if you're lazy like me, you could also just redeclare the variable somewhere at the top of profile.php, as in:

$pun_config['o_avatars_dir'] = PUN_ROOT.$pun_config['o_avatars_dir'];

That should do the trick for you.. I think.  Also, deleting the file size check part is a bad idea, as the script would then simply accept images of any size, which I would not exactly recommend.  The file size check should work just fine if everything's laid out correctly, I didn't really touch that part of the code (though I did move it around a little).

Hope this helps.

I was looking for the same thing, but found nothing.  So I decided to make it myself.  I'm not exactly an expert at PHP, and I haven't had the opportunity to test my modification extensively (other than on my own server setup), but hey it works for me.

If that doesn't scare you off, this is what I ended up with: http://ohok.nl/stuff/profile.txt (or do you like pretty colours?)

Basically what it does is resize any image that's wider and/or higher than allowed, to whatever's set to be the maximum, maintaining the original aspect ratio.  Since resizing the image also changes the file size, I had to move the file size check until after the resizing is done, and also comment out the MAX_FILE_SIZE hidden form field, as big files can be made smaller now.

It's also supposed to scale down gracefully if the GD library isn't installed, or if the image format isn't supported by it.  In either case the script should return to the default PunBB behaviour and simply reject the image if it's too large.  The only difference is the absence of the MAX_FILE_SIZE hidden form field (not that I personally mind, since the output PHP gives me when using it is a meaningless blob of code anyway).  But this doesn't really affect anything, since the file size is double checked by the script anyway.

I'd turn this into a nicely distributed 'mod' or 'plugin' but I have no idea how, sorry.  Hope this will be of help to someone anyway.

P.S. My modifications start at around line 350 and end with the now commented out MAX_FILE_SIZE hidden form field, which is now at line 463.  I tried to play nice and comment my code, but if you have any questions feel free to ask.

EDIT: This was turned into a proper mod some time ago.  Please refer to http://punbb.org/forums/viewtopic.php?id=16883 rather than following the instructions in this post.