Forums

Unfortunately no one can be told what FluxBB is - you have to see it for yourself.

You are not logged in.

#1 2012-04-02 19:02:00

Wan
Member
From: France
Registered: 2011-10-17
Posts: 45

[MOD] Easy Avatar

Adds two features to upload avatar:
- Automatic resizing,
- Uploading by URL.

(NB: the GD library must be enabled in PHP)

This mod allows users to upload an avatar by pasting a simple link to an image file. The mod contains an automatic image resizing when exceeding the parameters set in the administration/options panel.
To avoid the risk of overflow, the remote upload by URL is done by packets to a limit set also in the administration/options panel.
Automatic resizing also applies to the classic upload.

If the GD library is disabled, the mod is inactive but leaves the conventional operation of the upload function work.

I worked hard to ensure maximum safety. I wait for your comments.

Download : Easy Avatar

Last edited by Wan (2012-04-02 19:12:46)

Offline

#2 2012-04-02 20:02:44

arw
Member
Registered: 2012-03-20
Posts: 117

Re: [MOD] Easy Avatar

hi,


thanks ^^

this line ( line 99 of readme.txt )

		if (imagetypes() & $cur_image_type)

it seems odd to me, & is the operator to get a reference, didn't you meant && ?

and it seems to be possible to put something in a "config.ini" to choose a max filesize, but there is no indication of how

Offline

#3 2012-04-02 21:04:20

Newman
Member
Registered: 2011-11-05
Posts: 350

Re: [MOD] Easy Avatar

You might want to add

something like

if ( preg_match( "#javascript:#is", $_POST['form']['avatarfieldnamehere'] ) ) {
            $_POST['form']['avatarfieldnamehere'] = "";
        }

incase of hackers.. or just do message("Javascript Extensions are not allowed");

Don't want anyone doing any hacking big_smile

Great mod though!

Last edited by Newman (2012-04-02 21:04:48)

Offline

#4 2012-04-02 21:18:59

furqi
Member
Registered: 2012-04-02
Posts: 3

Re: [MOD] Easy Avatar

this work for 1.4.7?

Offline

#5 2012-04-03 00:20:35

Newman
Member
Registered: 2011-11-05
Posts: 350

Re: [MOD] Easy Avatar

furqi wrote:

this work for 1.4.7?

yes

Offline

#6 2012-04-03 04:42:12

Wan
Member
From: France
Registered: 2011-10-17
Posts: 45

Re: [MOD] Easy Avatar

arw wrote:

this line ( line 99 of readme.txt )

		if (imagetypes() & $cur_image_type)

it seems odd to me, & is the operator to get a reference, didn't you meant && ?

"&" is an binary operator : it means "and". If the two binary entities imagetypes() and $cur_image_types ares equals, this expression returns TRUE.

Offline

#7 2012-04-03 04:50:06

Wan
Member
From: France
Registered: 2011-10-17
Posts: 45

Re: [MOD] Easy Avatar

arw wrote:

(..) it seems to be possible to put something in a "config.ini" to choose a max filesize, but there is no indication of how

The max filesize for the mod can be set in the administration/options panel (section "avatar").
But it exists a "natural" limit named post_max_size fixed by PHP (not by FluxBB). It can be set in the config.ini of PHP. Use a phpinfo() to verify this limit on your server.

[EDIT] You can verify post_max_size with this mod too : try to set the max file size at 9 999 999 bytes in the administration panel, the mod will decrease it to the post_max_size value.

Last edited by Wan (2012-04-03 05:17:57)

Offline

#8 2012-04-03 04:57:45

Wan
Member
From: France
Registered: 2011-10-17
Posts: 45

Re: [MOD] Easy Avatar

Newman wrote:

You might want to add

something like

if ( preg_match( "#javascript:#is", $_POST['form']['avatarfieldnamehere'] ) ) {
            $_POST['form']['avatarfieldnamehere'] = "";
        }

incase of hackers.. or just do message("Javascript Extensions are not allowed");

Don't want anyone doing any hacking big_smile

Great mod though!

Because of the upload by blocks, it seems not necessary : no script can be active in this way. The final upload is then recorded with a rename function which inactivate any script.
I tried with a file like "image.php.jpg" wich is active in a normal way : the mod doesn't recognize it like an image and refuse to upload it.

Offline

#9 2012-04-03 05:00:22

Wan
Member
From: France
Registered: 2011-10-17
Posts: 45

Re: [MOD] Easy Avatar

Newman wrote:
furqi wrote:

this work for 1.4.7?

yes

Thanks for this verification, I'll add this compability in the repository.

Offline

#10 2012-04-03 05:27:42

Newman
Member
Registered: 2011-11-05
Posts: 350

Re: [MOD] Easy Avatar

Wan wrote:
Newman wrote:

You might want to add

something like

if ( preg_match( "#javascript:#is", $_POST['form']['avatarfieldnamehere'] ) ) {
            $_POST['form']['avatarfieldnamehere'] = "";
        }

incase of hackers.. or just do message("Javascript Extensions are not allowed");

Don't want anyone doing any hacking big_smile

Great mod though!

Because of the upload by blocks, it seems not necessary : no script can be active in this way. The final upload is then recorded with a rename function which inactivate any script.
I tried with a file like "image.php.jpg" wich is active in a normal way : the mod doesn't recognize it like an image and refuse to upload it.

I thought this was a URL Offsite linking mod, my bad... lol

Offline

#11 2012-04-03 05:45:20

Wan
Member
From: France
Registered: 2011-10-17
Posts: 45

Re: [MOD] Easy Avatar

Newman wrote:

I thought this was a URL Offsite linking mod, my bad... lol

No : those mods are safeless unsafe... (sorry for this bad english language...)

Last edited by Wan (2012-04-03 05:57:37)

Offline

#12 2012-04-03 06:13:58

Newman
Member
Registered: 2011-11-05
Posts: 350

Re: [MOD] Easy Avatar

Wan wrote:
Newman wrote:

I thought this was a URL Offsite linking mod, my bad... lol

No : those mods are safeless unsafe... (sorry for this bad english language...)

no

not with curl and proper coding

d2jsp.org is the worlds largest forum (almost) and they use it, so please tell me how it's "unsafe" you're the 4th person to say that, lol
pretty sure they would have been "Hacked" by now if you think it's "unsafe" am I right? big_smile

Last edited by Newman (2012-04-03 06:14:28)

Offline

#13 2012-04-03 06:41:22

Wan
Member
From: France
Registered: 2011-10-17
Posts: 45

Re: [MOD] Easy Avatar

Newman wrote:
Wan wrote:
Newman wrote:

I thought this was a URL Offsite linking mod, my bad... lol

No : those mods are safeless unsafe... (sorry for this bad english language...)

no

not with curl and proper coding

d2jsp.org is the worlds largest forum (almost) and they use it, so please tell me how it's "unsafe" you're the 4th person to say that, lol
pretty sure they would have been "Hacked" by now if you think it's "unsafe" am I right? big_smile

I meant : I never saw on FluxBB (or PunBB) any really safe mod published using direct linking.
Maybe you can try to do that with a proper coding ! wink

Offline

#14 2012-04-03 07:14:36

Newman
Member
Registered: 2011-11-05
Posts: 350

Re: [MOD] Easy Avatar

Wan wrote:
Newman wrote:
Wan wrote:

No : those mods are safeless unsafe... (sorry for this bad english language...)

no

not with curl and proper coding

d2jsp.org is the worlds largest forum (almost) and they use it, so please tell me how it's "unsafe" you're the 4th person to say that, lol
pretty sure they would have been "Hacked" by now if you think it's "unsafe" am I right? big_smile

I meant : I never saw on FluxBB (or PunBB) any really safe mod published using direct linking.
Maybe you can try to do that with a proper coding ! wink

hahah

no1 here trusts me after my mistake with the bandwidth issue sad

Offline

#15 2012-04-03 07:33:54

arw
Member
Registered: 2012-03-20
Posts: 117

Re: [MOD] Easy Avatar

on my forum, I just replaced upload avatar by a link to gravatar.com , I replaced the function generate_avatar_markup to :

//
// Outputs markup to display a user's avatar
//
function generate_avatar_markup($user_email)
{
  return '<img src="http://www.gravatar.com/avatar/'.md5($user_email).'?d=identicon" width="80" height="80" alt="" />';
}

and called the function with mail in argument :

profile.php:1073:		$avatar_field = generate_avatar_markup($user['email']);
profile.php:1474:		$user_avatar = generate_avatar_markup($user['email']);
viewtopic.php:243:				$user_avatar = $user_avatar_cache[$cur_post['poster_id']] = generate_avatar_markup($cur_post['email']);

but well, it's still relying to a third party and there is some limitations ( avatar image must be a square )

Wan wrote:
arw wrote:

this line ( line 99 of readme.txt )

		if (imagetypes() & $cur_image_type)

it seems odd to me, & is the operator to get a reference, didn't you meant && ?

"&" is an binary operator : it means "and". If the two binary entities imagetypes() and $cur_image_types ares equals, this expression returns TRUE.

ah yes, I forgot about bitwise operators since i'm never using that in php

otherway, it will also return true in other cases, for example : 19 & 15 => 3

Offline

#16 2012-04-03 07:35:39

Wan
Member
From: France
Registered: 2011-10-17
Posts: 45

Re: [MOD] Easy Avatar

Newman wrote:

no1 here trusts me after my mistake with the bandwidth issue sad

Sorry, I don't really understand what you mean... hmm
I just meant, if you think a safe code is possible, you could try to make one starting from this mod for exemple: https://fluxbb.org/forums/viewtopic.php … 393#p45393
Personally, I deedn't succeed...

(Note : in writing "no1", I think you're mistaken about the signification of my alias : it's just a diminutive of my first name (Erwan) given by my friends. I'm far to be "no1", coding in PHP for only 2 years... wink)

Offline

#17 2012-04-03 07:37:16

Newman
Member
Registered: 2011-11-05
Posts: 350

Re: [MOD] Easy Avatar

Wan wrote:
Newman wrote:

no1 here trusts me after my mistake with the bandwidth issue sad

Sorry, I don't really understand what you mean... hmm
I just meant, if you think a safe code is possible, you could try to make one starting from this mod for exemple: https://fluxbb.org/forums/viewtopic.php … 393#p45393
Personally, I deedn't succeed...

(Note : in writing "no1", I think you're mistaken about the signification of my alias : it's just a diminutive of my first name (Erwan) given by my friends. I'm far to be "no1", coding in PHP for only 2 years... wink)

lol meant no1 as in "no one"

sorry tongue

lol long story short, I thought memory usage was bandwidth usage and the developers shot me down big_smile

Offline

#18 2012-04-03 08:57:59

Wan
Member
From: France
Registered: 2011-10-17
Posts: 45

Re: [MOD] Easy Avatar

arw wrote:

otherway, it will also return true in other cases, for example : 19 & 15 => 3

That's right. I actually think it's a bitmask. So, if the byte $cur_image_type is in the bitfield imagetypes(), the mask returns TRUE (like 19 & 15) : it means the image type is supported by GD.

Offline

#19 2012-04-09 17:47:24

Wan
Member
From: France
Registered: 2011-10-17
Posts: 45

Re: [MOD] Easy Avatar

V1.1 released with default avatar available and manageable.
---> https://fluxbb.org/resources/mods/easy- … eases/1.1/

Thanks for comments and/or other language traductions.

Offline

#20 2012-04-20 10:46:41

Wan
Member
From: France
Registered: 2011-10-17
Posts: 45

Re: [MOD] Easy Avatar

The readme.txt of v1.1 was bugged.
Sorry about this : the "debugged" version is now available with a patch for those who applied v1.1
---> https://fluxbb.org/resources/mods/easy- … ses/1.1.1/
Thanks to apply it and to report any others problem or to furnish others language packages.

Last edited by Wan (2012-04-20 11:37:49)

Offline

#21 2012-11-02 13:56:12

Sxderp
Member
Registered: 2012-11-02
Posts: 101

Re: [MOD] Easy Avatar

When resizing a transparent image the transparent parts become black. Is there a way to prevent this from happening so the image resizes correctly?

Offline

#22 2012-11-02 23:32:46

Sxderp
Member
Registered: 2012-11-02
Posts: 101

Re: [MOD] Easy Avatar

Sorry for double post, but a buddy of mine did what I requested. Here is the modified code in case anyone wishes to have the same functions.

pastebin.com/1Ds5junu

Offline

#23 2013-06-05 02:00:21

Visman
Member
From: Siberia
Registered: 2010-07-10
Posts: 1,209
Website

Re: [MOD] Easy Avatar

v1.1.2
Why this form is specified for replacement?

#
#---------[ 17. FIND ]-------------------------------------------------
#

<div class="blockform">
	<h2><span><?php echo $lang_profile['Confirm delete user'] ?></span></h2>
	<div class="box">
		<form id="confirm_del_user" method="post" action="profile.php?id=<?php echo $id ?>">
			<div class="inform">
				<fieldset>
					<legend><?php echo $lang_profile['Confirm delete legend'] ?></legend>
					<div class="infldset">
						<p><?php echo $lang_profile['Confirmation info'].' <strong>'.pun_htmlspecialchars($username).'</strong>.' ?></p>
						<div class="rbox">
							<label><input type="checkbox" name="delete_posts" value="1" checked="checked" /><?php echo $lang_profile['Delete posts'] ?><br /></label>
						</div>
						<p class="warntext"><strong><?php echo $lang_profile['Delete warning'] ?></strong></p>
					</div>
					
					
#
#---------[ 18. REPLACE WITH ]--------------------------------------------
#

<div class="blockform">
<?php if ($id == 0) : ?>
	<h2><span><?php echo $lang_EZavatar['Upload default avatar'] ?></span></h2>
<?php else : ?>
	<h2><span><?php echo $lang_profile['Upload avatar'] ?></span></h2>
<?php endif; ?>
	<div class="box">
		<form id="upload_avatar" method="post" enctype="multipart/form-data" action="profile.php?action=upload_avatar2&amp;id=<?php echo $id ?>" onsubmit="return process_form(this)">
			<div class="inform">
				<fieldset>
<?php if ($id == 0) : ?>
					<legend><?php echo $lang_EZavatar['Upload default avatar legend'] ?></legend>
<?php else : ?>
					<legend><?php echo $lang_profile['Upload avatar legend'] ?></legend>
<?php endif; ?>
					<div class="infldset">
						<input type="hidden" name="form_sent" value="1" />
						<input type="hidden" name="MAX_FILE_SIZE" value="<?php echo $pun_config['o_avatars_upload_size'] ?>" />
<?php
if ($gd_image_types_ability):
?>
						<label><strong><?php echo $lang_profile['File'].'...' ?></strong><br /><input name="req_file" type="file" size="40" /><br /></label>
						<label><strong><?php echo $lang_EZavatar['URL'] ?></strong><br /><input name="req_url" type="text" size="40" /><br /></label>
<?php
else:
?>
						<label class="required"><strong><?php echo $lang_profile['File'] ?> <span><?php echo $lang_common['Required'] ?></span></strong><br /><input name="req_file" type="file" size="40" /><br /></label>
<?php
endif;
if ($id != 0) :
?>
						<p><?php echo $lang_profile['Avatar desc'].' '.forum_number_format($pun_config['o_avatars_upload_size']).' '.$lang_profile['bytes'].' ('.file_size($pun_config['o_avatars_upload_size']).'). <br />'.$lang_EZavatar['Avatar desc'].$pun_config['o_avatars_width'].' x '.$pun_config['o_avatars_height'].' '.$lang_profile['pixels'].' '.$lang_common['and'].' '.forum_number_format($pun_config['o_avatars_size']).' '.$lang_profile['bytes'].' ('.file_size($pun_config['o_avatars_size']).').' ?></p>
<?php
endif;
?>						
					</div>

Offline

Board footer

Powered by FluxBB