Foren / Cotonti / Support / Noavatar, how about noimage?

12NächsteLetzte

DemptD
#1 13. April 2009, 06:42
There is a default noavatar image that comes when the user has no avatar.

Is it possible to get a "nophoto" image?
TwistedGA
#2 13. April 2009, 15:19
I tried to get it close. I'm not sure exactly what two effects they used so it's only close, not exact. I'd say the only person who knows the exact effects used is the creator of the sed-light skin.

Original and Request compared.

[color=#CC0000]Lazymod[/color] [color=#000000]Studios[/color]
pieter
#3 13. April 2009, 15:46
I guess he ment, how to change it in Cotoni that when a user don't upload a photo, a standard one will appear.


BTW: Nicely done.
... can we help you ...
DemptD
#4 13. April 2009, 22:19
# pieter : I guess he ment, how to change it in Cotoni that when a user don't upload a photo, a standard one will appear.


BTW: Nicely done.

Yes, thats what i meant :)
TwistedGA
#5 14. April 2009, 01:42
Ahhh, my bad. I'll write ya some code for it later.

Open up your functions.php and search for:

	elseif($type == 'photo')
	{
		if(!empty($image))
		{
			return '<img src="'.$image.'" alt="" class="photo" />';
		}

	}

Replace with:

	elseif($type == 'photo')
	{
		if(empty($image))
		{       
                        $image = 'datas/defaultav/blank2.png';
                  }
                  return '<img src="'.$image.'" alt="" class="photo" />';
	}


You need to have blank2.png in the same folder as the blank.png for this to work. :-)
[color=#CC0000]Lazymod[/color] [color=#000000]Studios[/color]

Dieser Beitrag wurde von TwistedGA (am 14. April 2009, 04:15, vor 15 Jahre) bearbeitet
DemptD
#6 14. April 2009, 05:35
Thanks! Works perfectly :)
CorpQuid
#7 14. April 2009, 05:41
Nice Job, works excellent!
Thank you
simplex
#8 14. April 2009, 06:32
Even better, how about the "No Avatar" image links to the users profile page.
So if a user sees their "No Avatar" image they can click on it and load one into their profile.
Lissbol
#9 14. April 2009, 17:56
you probably could fix it with sql instead of doing corehax

Run this with phpMyAdmin, tab "SQL" :

Code:
ALTER TABLE sed_users CHANGE user_avatar user_avatar varchar(255) collate utf8_unicode_ci NOT NULL default 'datas/avatars/default.gif';

... And upload the default GIF : datas/avatars/default.gif


Optionally, you can also set this default image for the already registered members with no avatar :

Code:
UPDATE sed_users SET user_avatar='datas/avatars/default.gif' WHERE user_avatar='';

did work on the Sed engine should work on Cotonti aswell
LISSBOL Designs
Kingsley
#10 15. April 2009, 04:34
# TwistedGA : Ahhh, my bad. I'll write ya some code for it later.

Open up your functions.php and search for:

	elseif($type == 'photo')
	{
		if(!empty($image))
		{
			return '<img src="'.$image.'" alt="" class="photo" />';
		}

	}

Replace with:

	elseif($type == 'photo')
	{
		if(empty($image))
		{       
                        $image = 'datas/defaultav/blank2.png';
                  }
                  return '<img src="'.$image.'" alt="" class="photo" />';
	}


You need to have blank2.png in the same folder as the blank.png for this to work. :-)

Somehow this isn't working for me. It won't display the image at all.. only get a red cross..
CorpQuid
#11 15. April 2009, 05:29
Did you upload the blank2 image from Twisted first post above?

http://www.cotonti.com/datas/users/blank2_252.png

Download that image and put it in the datas/defaultav/ folder and you should be all set.

You need to either rename the image to blank2.png or you need to modify the code twisted gave above to

$image = 'datas/defaultav/blank2_252.png';
esclkm
#12 15. April 2009, 12:02
I think that this is bad idea. We have logic in new version of Xtemplate by medar. And noimage we can realise with help of this Without any core hacks
littledev.ru - мой маленький зарождающийся блог о котонти.
снижение стоимости программирования и снижение стоимости производства разные вещи. Первое можно скорее сравнить с раздачей работникам дешевых инструментов, чем со снижением зарплаты
Kingsley
#13 15. April 2009, 15:02
@ CorpQuid

I tried it with the image provided by Twisted and with one I made myself. Everytime I get the red cross.
even tried to do it with blank.png.

Followed twisted post to the letter.

@esclkm

If you have a better way, please share it with us..
CorpQuid
#14 16. April 2009, 02:01
esclkm,

I can not find the template that you mentioned "Xtemplate by medar" can you share the logic that you have so that we can implement this in our own templates? Or am I miss-understanding you?

Lissbol,

I noticed your suggestion is for the Avatar, would we just change the paths and such to reflect for the photo? The avatar currently works fine out of the box Cotonti install, it's the Photo thats not showing.

Kingsley,

The way they are suggesting I believe is much better so lets wait for them to reply, this way we do not have to core hack our installs. :-)
TwistedGA
#15 16. April 2009, 02:16
I can't imagine why it's not working Kingsley.. Very odd..

Here is the SQL to run should you not want to core hack it in. Which by the way, are very uninvasive and easy to uninstall if you do it like you should and make backups, not hard. There is absolutely nothing wrong with corehacking.

UPDATE sed_users SET user_photo='datas/defaultav/blank2.png' WHERE user_photo='';
ALTER TABLE sed_users CHANGE user_photo user_photo varchar(255) NOT NULL default 'datas/defaultav/blank2.png';
[color=#CC0000]Lazymod[/color] [color=#000000]Studios[/color]

12NächsteLetzte