News:

Bored?  Looking to kill some time?  Want to chat with other SMF users?  Join us in IRC chat or Discord

Main Menu

Avatar Thumbnails

Started by Stanyy, April 24, 2015, 08:49:58 AM

Previous topic - Next topic

Stanyy

Hi,
I have resized the avatars on post pages to look like icons. But the problem is, the page still loads the full image (e.g 500KB).

How do I auto create thumbnails for avatars?
Or compress the avatars on the fly?

Kindred

HOW did you "resized the avatars on post pages to look like icons"?

if you resize using CSS or height/width settings -- then, absolutely, you have not changed the image itself, just the display...  it will still load the large file and then display it in the size that you specified. That's how web pages work.

You can set the max height and width for avatars in the admin settings....
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

Stanyy

Hi, thank you for the reply.

Yes I have resized them using css, you are right.
I actually want the images in profile pages to stay normal (the size I have set it to in avatar settings);
and the images in post pages to look smaller and have a smaller size.

Kindred

Then you can not do anything.

SMF pulls the same image for all instances of the avatar. If you want it large in some places, and small in others, then you are going to have to deal with the large (filesize) image in all places
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

Stanyy

Quote from: Kindred on April 24, 2015, 01:02:04 PM
Then you can not do anything.

Nothing?
Xenforo has this functionality. I'm just saying.

Kindred

I would bet that it does not...

SMF can and will resize files that users upload as avatars...  but that setting is global.
So you can have SMF resize images to be 100x100 (and thus be a smaller file size) However that means that the avatar FILE will be 100100 in ALL instances where it is displayed.

If you opt to display a smaller image in the post mini-profile (or anywhere else) -- it is still using the same file that is used elsewhere... it does not create multiple copies of the image files in multiple sizes.

And you should know by now that saying "xyz does this" is a completely invalid argument.
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

Stanyy

Quote from: Kindred on April 24, 2015, 05:59:19 PM

And you should know by now that saying "xyz does this" is a completely invalid argument.

This is actually a valid argument. You said "No you cannot do anything" which directly means "its not possible". I am only responding by showing you where it has been done somewhere else.

Quote from: Kindred on April 24, 2015, 05:59:19 PM
it does not create multiple copies of the image files in multiple sizes.
Exactly what Xenforo does. (again, just for records.)

Quote from: Kindred on April 24, 2015, 05:59:19 PM
I would bet that it does not...
I knew you were going to say that, which was why I even brought it up in the first place.

1. Recent Posts = https://xenforo.com/community/find-new/6807709/posts
The avatars on the recent posts page are small sized thumbnails (seperate files!)
Avatar = https://xenforo.com/community/data/avatars/s/0/90.jpg

2. Post Pages = https://xenforo.com/community/threads/html-newsletter-generator-with-showcase-resource-manager-gallery-attachment-support-paid.90770/
Avatar (same user) = https://xenforo.com/community/data/avatars/m/0/90.jpg

3. Actual Profile =  (popup)
Actual Avatar (same user) = https://xenforo.com/community/data/avatars/l/0/90.jpg

Three separate files. It's beautiful and makes sense.

Just saying.


Kindred

1- no, it is not a valid argument....   and I never said "it can't be done"   I said, you can't do that (impied is: with SMF core and/or an current mods)

2- uploading multiple copies of files is a crap way to deal with things, IMO... and I am surprised that xenforo does that -- because it is such a crap way of dealing with it.

either way...   in general, we don't particularly care what others are doing... and certainly not at all in this case.  So, if you can find someone to code it for you, excellent for you...   I suggest you post on the help wanted/paid board.
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

br360

There are at least two mods that will add avatars or images to either the board index or message index. Both of those mods have ways to decrease the size of the images (avatar) to whatever you want- and pretty sure that neither of them do it by changing css.

See how it was done here with the avatar on board mod- http://www.simplemachines.org/community/index.php?topic=223656.msg3350732#msg3350732
The thumbnail on topic listing- http://custom.simplemachines.org/mods/index.php?mod=1151

A topic starter code that I think works off the avatar on board mod- http://www.simplemachines.org/community/index.php?topic=534312.msg3797075#msg3797075


Stanyy

Quote from: br360 on April 24, 2015, 08:28:47 PM
There are at least two mods that will add avatars or images to either the board index or message index. Both of those mods have ways to decrease the size of the images (avatar) to whatever you want- and pretty sure that neither of them do it by changing css.

See how it was done here with the avatar on board mod- http://www.simplemachines.org/community/index.php?topic=223656.msg3350732#msg3350732
The thumbnail on topic listing- http://custom.simplemachines.org/mods/index.php?mod=1151

A topic starter code that I think works off the avatar on board mod- http://www.simplemachines.org/community/index.php?topic=534312.msg3797075#msg3797075

They are all loading the same large file.
I am not trying to reduce height and width. I am trying to reduce the filesize of avatars on posts without compromising avatars on members profiles. If i want users to have a large and clear photo on their profile (e.g 1mb), posts shouldn't load the same image, there should be a lighter compressed version. I believe this would improve page load.

Stanyy

Quote from: Kindred on April 24, 2015, 08:10:30 PM
2- uploading multiple copies of files is a crap way to deal with things, IMO... and I am surprised that xenforo does that -- because it is such a crap way of dealing with it.

I believe it would improve page load (if I'm not mistaken).

br360

Quote from: Stanyy on April 25, 2015, 05:30:51 PM
They are all loading the same large file.
I am not trying to reduce height and width. I am trying to reduce the filesize of avatars on posts without compromising avatars on members profiles. If i want users to have a large and clear photo on their profile (e.g 1mb), posts shouldn't load the same image, there should be a lighter compressed version. I believe this would improve page load.

But there are settings in both mods that will allow you to resize the last post avatar and the topic starter without it affecting the size of the avatar in profiles or anywhere else. These are two screen caps from a couple of my sites. Notice that the avatar size everywhere else including profiles is 100x100- and the mod specific settings are at 25x25.




Kindred

It might improve page load...  But would severely impact server resources.

Seriously...  Either require a smaller image or deal with it...

Or try on of those mods that br360 suggested...
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

Stanyy

Quote from: br360 on April 25, 2015, 05:55:01 PM

But there are settings in both mods that will allow you to resize the last post avatar and the topic starter without it affecting the size of the avatar in profiles or anywhere else. These are two screen caps from a couple of my sites. Notice that the avatar size everywhere else including profiles is 100x100- and the mod specific settings are at 25x25.

You still misunderstand me. We are talking about two completely different things. I have already setup 'small sized' avatars around my forum and have been using them for a long time now, just like in your screenshots.
I am referring to the size (in kilobytes) of the image file.

On your Genx forum, for example, the filesize of the thumbnails and the main avatar are all of the same size = 13.66KB.

I am looking to serve a smaller (have this) but compressed (don't have this) file.

Biology Forums

Hello Stanyy,

Rule of thumb, ANYTHING can be done with coding. In fact, you could get someone to alter the way SMF handles avatar uploads to produce different sizes. Issue I see with this are capacity problems with servers. Let's face it, given that Xenforo cost money to acquire, most users can afford something more powerful than a shared server, so Xenforo can afford to make multiple images without eating up resources. When I started my community, I didn't have the funds to spend money on a powerful server, so the way SMF handled avatars fit my needs, because it didn't bust the bank. Personally I believe there is logic to creating several sizes, rather than having CSS resize a larger image, but that's just the way it's done here (SMF - 'simple' machine forum).

Kindred

and you seem to have missed the biggest point of all   ----   reducing the image's pixel width/height WILL reduce the filesize.

If you insist on doing it, those mods look to be your best bet.
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

Siirist

#16
Hi,

Just so that everyone knows, I went to free-avatars.com and downloaded about 30 avatars for my gallery of avatars for users to chose.

The site has you click on the avatar you want,
new window opens and lets you choose what size and I chose 125x125,
and then click on download.

Then I use Filezilla to upload then to my forum.

Simple

You can see it on my test forum Test Forum

Username=testmember
password=letmesee

It is a simple newbie level so you will not have any power

This username and password will be removed in seven (7) days

Be Well,
Siirist
Needed information:
- What's your SMF version?, What MODs are installed? What Theme(s) are you using? Have you backed up your database?

--> At least 50% of the questions asked are answered in the Online Manual <--
Mods for ver 1.x will NOT run on ver 2.x

Stanyy

Quote from: Kindred on April 25, 2015, 07:13:51 PM
If you insist on doing it, those mods look to be your best bet.
I feel like I'm being punished having to say the same thing multiple times. I ALREADY HAVE resized avatars around my forum (board and message index).

Quote from: Kindred on April 25, 2015, 07:13:51 PM
and you seem to have missed the biggest point of all   ----   reducing the image's pixel width/height WILL reduce the filesize.
Again, that is not true. I am curious as to why you think ordinarily resizing an image will reduce its file size.
I have attached proof photos that shows that the browser actually loads the same filesize.

Br360, please allow me to use your forum for the illustration.

Stanyy

Quote from: Shuban on April 25, 2015, 07:12:51 PM
Hello Stanyy,

Rule of thumb, ANYTHING can be done with coding. In fact, you could get someone to alter the way SMF handles avatar uploads to produce different sizes. Issue I see with this are capacity problems with servers. Let's face it, given that Xenforo cost money to acquire, most users can afford something more powerful than a shared server, so Xenforo can afford to make multiple images without eating up resources. When I started my community, I didn't have the funds to spend money on a powerful server, so the way SMF handled avatars fit my needs, because it didn't bust the bank. Personally I believe there is logic to creating several sizes, rather than having CSS resize a larger image, but that's just the way it's done here (SMF - 'simple' machine forum).

That is true, but if all those thumbnails are lightweight (i'm talking bytes), there wont be noticeable impact on resources.
Another option I suggested was to compress the images on the fly, but i don't know how if that would work out well or not. I found something online - http://www.white-hat-web-design.co.uk/blog/resizing-images-with-php/
Take a look at the 5th code block which is supposed to compress on request without saving.

The main file at the bottom contains $compression=75 which i believe is responsible for the compression.

Kindred

resizing the image height/width (for real, not by css) **WILL** reduce the file size as well. period.

If the mods that br360 pointed you to do not actually change the width/height, but merely alter the displayed height/width, then - obviously - the file size will not change...

I still call it a bad process (it is one of the most annoying things I have found that WordPress does...) but, if you are set on doing it, then I will move this to the coding board, since this is well outside of support
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

Advertisement: