How to avatar auto resize on upload?

@halilesen · 10 Apr 2024 · 170 views
Post Reply
User avatar
halilesen
#1 ·
Posts: 38
Joined: 24 Mar 2024, 18:09
Full Name: Halil ESEN
Has liked: 3
Been liked: 1
phpbb-auto-resize-avatar-phpbb-avatar-resize-phpbbgroup.jpg
phpbb-auto-resize-avatar-phpbb-avatar-resize-phpbbgroup.jpg (108.47 KiB) Viewed 142 times

It is extremely important that the avatars uploaded by users in your phpBB forum automatically transform to the size you specify. This is because not every user may want to deal with resizing their avatar, or profile picture. However, resizing the avatar during upload makes it easier for both parties. Here I will explain how you can automatically resize avatars to be uploaded to your phpBB board.

Although automatic avatar resizing is rumored to be coming in a future release, phpBB does not yet have it by default. But you can add this feature by installing a very lightweight extension. Developed by user Ger at phpBB.com, this extension resizes uploaded avatars that exceed allowed dimensions to those maximum settings.

Let's go step by step. First, download the extension that I have made ready for installation.

avatarresize.zip
(10 KiB) Downloaded 40 times

Install and export the extension in the /ext folder in the phpBB root. Then go to ACP and enable the extension in Customize tab > Extensions Manager. Have installed the extension, now let's check the Avatar settings.

Go to General tab > Board configuration menu > Avatar settings. First, make sure "Enable avatars: Yes". Then look at the maximum avatar dimensions and minimum avatar dimensions options right below.

The extension will resize avatars according to the maximum avatar dimensions option, but I usually set the minimem option the same way.

phpbb-avatar-resize-auto-avatar-size-phpbb_group.jpg
phpbb-avatar-resize-auto-avatar-size-phpbb_group.jpg (20.07 KiB) Viewed 170 times

This is a personal preference, if you want to accept avatars smaller than the maximum size, enter a value to suit your preference. Whatever happens, make sure all inputs are full. In the past I have gotten various errors when I left some of them empty.

Finally, set the "maximum avatar file size" option to 0, just in case. Sumit.

This way, the avatars uploaded to your phpBB dashboard will automatically be adjusted to the size you specify.

If you want, you can delete the following line from your style's ucp_avatar_options.html file, which gives min and max avatar size information in UCP later.

Code: Select all

<dt><label>{L_CURRENT_IMAGE}{L_COLON}</label><br /><span>{L_AVATAR_EXPLAIN}</span></dt>
But you may need to redo it from style updates. Another option is to edit the language files.

Share your thoughts. Do you use automatic avatar resizing? Were you able to complete the installation without any errors by following the post?
Post Reply
  • Similar Topics