avatar autoresize

Looking for an Extension? Have an Extension request? Post your request here for help. (Note: This forum is community supported; while there is an Extensions Development Team, said team does not dedicate itself to handling requests in this forum)
Ideas Centre
User avatar
planetemuscle
Registered User
Posts: 4
Joined: Thu Jan 17, 2008 12:11 am
Location: South of France ( Montpellier )
Contact:

Re: avatar autoresize

Post by planetemuscle » Sun May 03, 2015 2:59 pm

+ 5.
Last edited by planetemuscle on Wed May 13, 2015 5:25 pm, edited 2 times in total.
Cordialement

Thierry

http://www.planetemuscle.com

User avatar
uruguayito
Registered User
Posts: 266
Joined: Mon Dec 13, 2010 2:46 pm
Location: Montevideo - Uruguay

Re: avatar autoresize

Post by uruguayito » Sun May 03, 2015 3:01 pm

Bump
I speak spanish
Sorry for my bad english

enavap
Registered User
Posts: 2
Joined: Sun May 03, 2015 5:39 am

Re: avatar autoresize

Post by enavap » Mon May 04, 2015 1:51 am

+1

R00f
Registered User
Posts: 26
Joined: Thu Mar 12, 2015 11:46 am

Re: avatar autoresize

Post by R00f » Mon May 04, 2015 4:40 pm

Very neeeeeeed!
Please relase!

sakkiotto
Registered User
Posts: 228
Joined: Mon Jun 13, 2005 9:45 pm

Re: avatar autoresize

Post by sakkiotto » Thu May 14, 2015 7:24 am

+1

Swanny
Registered User
Posts: 446
Joined: Sun Apr 14, 2002 2:11 am
Location: Canada

Re: avatar autoresize

Post by Swanny » Fri May 15, 2015 2:13 am

This should have been implemented long ago. So +1 on this for user friendly-ness.

nouse4anam3
Registered User
Posts: 26
Joined: Sat May 23, 2015 11:31 pm

Re: avatar autoresize

Post by nouse4anam3 » Sat Jun 06, 2015 11:14 pm

Would be great!!!!!

nouse4anam3
Registered User
Posts: 26
Joined: Sat May 23, 2015 11:31 pm

Re: avatar autoresize

Post by nouse4anam3 » Sat Jun 06, 2015 11:15 pm

would be great :idea:

User avatar
tahoebuff
Registered User
Posts: 1427
Joined: Tue Jul 20, 2004 12:33 am
Location: Nevada
Name: Michael
Contact:

Re: avatar autoresize

Post by tahoebuff » Sun Jun 07, 2015 6:39 pm

I used this on my 3.0 boards and it worked quit well. I see Dion updated it to work with the 3.1 version. I just tried it on my local test 3.1.4 forum. It works :)

Server-side resize of uploaded avatars

Read the entire #1 topic post, as there is a link (near bottom) for ACP Avatar settings adjustments and more.

As always, back up your files before modifying code.

This is Dion's hack and you should refer any questions to him...

Tahoebuff

User avatar
SalazarAG
Registered User
Posts: 673
Joined: Mon Mar 30, 2015 10:48 am

Re: avatar autoresize

Post by SalazarAG » Mon Jul 20, 2015 8:10 am

tahoebuff wrote:I used this on my 3.0 boards and it worked quit well. I see Dion updated it to work with the 3.1 version. I just tried it on my local test 3.1.4 forum. It works :)

Server-side resize of uploaded avatars

Read the entire #1 topic post, as there is a link (near bottom) for ACP Avatar settings adjustments and more.

As always, back up your files before modifying code.

This is Dion's hack and you should refer any questions to him...

Tahoebuff
It worked perfectly!

Breaking a twig while not develop an extension to it.
I'm sorry for my English. Google Translator does a bad job. :D

User avatar
martin123456
I've Been Banned!
Posts: 726
Joined: Sat Mar 05, 2011 7:44 pm

Re: avatar autoresize

Post by martin123456 » Mon Jul 20, 2015 1:20 pm

You dont need an ext to resize avatars i done it with plain css allow avatar uploads of any size and css will set it all at the chosen size and you can also add a hover on it ;)

every post on this page has different size avatars on mine every avatar in the forum are all the same size due to css resizing them to the setting i chose

Video of it

Code: Select all

<!-- IF S_CODE_UNTIDY and S_MESS_ON_INDEX Good If_Not_TIDY_Then_SUBMIT -->

User avatar
SalazarAG
Registered User
Posts: 673
Joined: Mon Mar 30, 2015 10:48 am

Re: avatar autoresize

Post by SalazarAG » Tue Jul 21, 2015 12:46 am

martin123456 wrote:You dont need an ext to resize avatars i done it with plain css allow avatar uploads of any size and css will set it all at the chosen size and you can also add a hover on it ;)

every post on this page has different size avatars on mine every avatar in the forum are all the same size due to css resizing them to the setting i chose

Video of it
Hello!

Could you explain how does? The video only showed the result, I would like to know how to do it
I'm sorry for my English. Google Translator does a bad job. :D

User avatar
martin123456
I've Been Banned!
Posts: 726
Joined: Sat Mar 05, 2011 7:44 pm

Re: avatar autoresize

Post by martin123456 » Tue Jul 21, 2015 2:04 pm

SalazarAG wrote: Could you explain how does? The video only showed the result, I would like to know how to do it
Sure view source in this topic http://www.martins-place.dyndns.info/vi ... 4&start=10 i am not home right now so cant get the code.

Code: Select all

<!-- IF S_CODE_UNTIDY and S_MESS_ON_INDEX Good If_Not_TIDY_Then_SUBMIT -->

User avatar
SalazarAG
Registered User
Posts: 673
Joined: Mon Mar 30, 2015 10:48 am

Re: avatar autoresize

Post by SalazarAG » Tue Aug 11, 2015 5:52 pm

Who are looking to develop this extension, I leave an idea to implement the extension:

the function $crop:

to automatically cut the avatars resized so that it fits the dimensions established automatically.
I'm sorry for my English. Google Translator does a bad job. :D

josegf
Registered User
Posts: 9
Joined: Mon Jan 12, 2015 7:59 pm

Re: avatar autoresize

Post by josegf » Fri Sep 11, 2015 12:16 pm

I created a solution, I hope this helps you.

You'll need PHP 5.5 in your server and PHP GD library. (Probably you have, it's very common config many wordpress theme uses PHP GD library)

Then you need to edit includes/functions_upload.php, locate a function called "move_file"

Before this function you need to add the following code:

Code: Select all

	function resize_image($file, $w, $h, $crop=FALSE)
	{
		list($width, $height) = getimagesize($file);
		$r = $width / $height;
		if ($crop) {
			if ($width > $height) {
				$width = ceil($width-($width*abs($r-$w/$h)));
			} else {
				$height = ceil($height-($height*abs($r-$w/$h)));
			}
			$newwidth = $w;
			$newheight = $h;
		} else {
			if ($w/$h > $r) {
				$newwidth = $h*$r;
				$newheight = $h;
			} else {
				$newheight = $w/$r;
				$newwidth = $w;
			}
		}
		if($this->extension == "jpg") $src = imagecreatefromjpeg($file);
		if($this->extension == "png") $src = imagecreatefrompng($file);
		$dst = imagecreatetruecolor($newwidth, $newheight);
		imagecopyresampled($dst, $src, 0, 0, 0, 0, $newwidth, $newheight, $width, $height);
		if($this->extension == "jpg") imagejpeg($dst,$file);
		if($this->extension == "png") imagepng($dst,$file);
	}
then in the move_file function locate the following code:

switch ($upload_mode)

just before this insert this code:

Code: Select all

$this->resize_image($this->filename,$this->upload->max_width,$this->upload->max_height);
And that's all :)

P.D. Please if you distribute/post this solution, please just mention me, thanks.

Cheers (ツ)
Jose A. Gallardo
Twitter: @Gallardo4Code

Post Reply

Return to “Extension Requests”

cron