Topic: Auto Resize - Crop Avatar ?!

As you know, there are a lot of newbies on the net and they don't know how to use a pic software (even PAINT !!! smile

So I have done this to explain people ...


How to create an avatar with Web Arles ...

So ... even if they understand, I think it would be great to "customize" the Upload Avatar FORM

1. If your avatar is GOOD SIZE (so for my case, 100x100 and max 15ko), OK, avatar is launched ...

2. You have a photo on your diskdrive : With GD or ImageMagick, possibility to crop from the center at the good size (OK, subject on the photo has to be good centered ... but very simple for the final user)

3. Like 2, but by enterering simply a PIC URL, the Avatar is created in 100x100

Advantages ? Have simply an avatar without knowing or dowload a pic soft.

Disadvantages : I don't know PHP, I don't want to know PHP ... so if someone has time to kill smile

2 (edited by Smartys 2004-10-23 11:18)

Re: Auto Resize - Crop Avatar ?!

3. Simply add to whereever the <img> tag for the avtar is displayed height=100 width=100

This will make bigger (or smaller) any image that isn't already 100x100.

So I think viewtopic.php and profile.php is where you need to check


Re: Auto Resize - Crop Avatar ?!

No at all smile

if someone put a pic 495x4084, I don't think your technique will be appreciated smile


Re: Auto Resize - Crop Avatar ?!

Which is why you set the max size in the forums to 100 x 100 tongue


Re: Auto Resize - Crop Avatar ?!

Yes I know it ...

but php could detect if a pic is too big or too large ... in this case, HOP, gd or Imagemagick, et you obtain a pic in 100x100, cropped.

(I have the impression my explanation is not clear, but english and me ...)

Re: Auto Resize - Crop Avatar ?!

Nah, it's clear, I just have no clue how it would be done tongue

Re: Auto Resize - Crop Avatar ?!

Can't you do something similar to what is being talked about in this thread:


Do you love physics? :) http://www.ilovephysics.com
Interested in Internet Marketing? http://www.keyliberty.com


Re: Auto Resize - Crop Avatar ?!

This is a pet peeve of mine with most php systems. Picture upload should be idiot proof!

I know it's not an issue if you have another geeky board (for gamers, coders or whatever), but the average user is not going to resize their pictures for you. They don't know how or can't be bothered.

Anyway, thame^ contributed some excellent code here! smile

I have some minor problems with it, so if anyone could help me squash those bugs the issue would be solved.

(The bugs may be specific to my site, because I have profile.php at the root as part of my main site, while PunBB is in a '/forum' folder. But everything else works fine...)

Re: Auto Resize - Crop Avatar ?!

The issue is that then GD is necessary wink


Re: Auto Resize - Crop Avatar ?!

Smartys wrote:

The issue is that then GD is necessary wink

Yes, but most serious hosts have that installed these days. My underlying point is that a lot of PHP scripts don't have the general end user in mind. I'm not talking about the people installing the scripts and building the sites, but the people using the websites. They could be your grandmother! They should be idiot-proof (not saying your grandmother's an idiot, but still...)!

Idiot-proof picture upload to me is a basic requirement. The code at that link in my previous post works really well, so the problem is solved in PunBB. smile

11 (edited by thame^ 2007-03-08 20:36)

Re: Auto Resize - Crop Avatar ?!

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.

Re: Auto Resize - Crop Avatar ?!

Behavior that isn't necessarily supported by all installs, that not everyone wants in the first place, and which would involve quite a bit more code (ie: in your code, what would happen if I uploaded a gif/png that needed transparency?) is better suited for an extension IMO smile
Plus, I think the auto-resizing issue can cause just as many issues for users. Especially if you have the kind of users that try to upload 100KB, 500x500 pictures of their pet. You'll simply be fielding "why did my picture shrink and look bad" questions instead of "what does this error mean" questions.

Re: Auto Resize - Crop Avatar ?!

Wait for 1.3, and write an extension.