MyBB Community Forums

Full Version: Give smilies and post icons attributes
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi there, I am working on speeding up my page load times - can anyone advise how I can add the width and height tags to smilies and post icons?

All my smilies/posticons are the same size.
For smilies:
Go to: ./inc/class_parser.php and find;
$this->smilies_cache[$smilie['find']] = "<img src=\"{$this->base_url}{$smilie['image']}\" style=\"vertical-align: middle;\" border=\"0\" alt=\"{$smilie['name']}\" title=\"{$smilie['name']}\" />";

and change it into;
$this->smilies_cache[$smilie['find']] = "<img src=\"{$this->base_url}{$smilie['image']}\" style=\"vertical-align: middle;\" border=\"0\" alt=\"{$smilie['name']}\" title=\"{$smilie['name']}\" width=\"25\" height=\"25\"/>";

For post icon;
Go to: ./inc/functions_post.php and find;
$post['icon'] = "<img src=\"{$icon['path']}\" alt=\"{$icon['name']}\" style=\"vertical-align: middle;\" />&nbsp;";

and change it into;
$post['icon'] = "<img src=\"{$icon['path']}\" alt=\"{$icon['name']}\" style=\"vertical-align: middle;\" width=\"25\" height=\"25\"/>&nbsp;";

Wink
Aha - I tried that with the post icons - but no effect - but I had added width=\"25px\" so thats why it did not work. Did not like the px for some reason. Thanks Smile

Hmmm, weird - I tried that - without the px - but I'm still getting page speed saying I have not specified the image dimensions.
Hmm, any idea as to why Yaldaram's solution should not work? It SHOULD - but I see no change - page speed is still crying that my post icons and smilies have no image dimensions.

I have changed the post icon image dimensions, in inc/functions_post_php and rebuilt the posticon cache.
I've re-checked it, it is working here.
See att. please,
Hmm, thanks for trying to help Yaldaram, but I am at a loss what that attachment of yours is trying to show. Take a look at this screenshot from this very thread as run through page speed (am not having a go at MYBB site, just showing an example).

You will see that the image sizes are NOT defined. That is what I am trying to achieve. Can you show YOUR screenshot of the pagespeed results as run on that page you made an picture of?

I had a look in the cache (I think that caching post icons and smilies is a good move?) and the image sizes are not defined there. Now, if the page is loading from the mybb cache and there are no image sizes defined IN that cache, then how can it show? It can't - right?
Hi Lee

Sorry I cant offer a solution but thats an interesting Add-on to Firebug. I've tried searching for it but cant find it. Can you tell us where to get it?
Hi Richard

Sure - its here

http://code.google.com/speed/page-speed/download.html

You need to open the page in FireFox and then just download and install like any other plugin. Make sure you are sitting in a chair you can faint in when you run it for the first time.
bump - is this a do-able thing? Yaldaram???
Hmm, well, I finally got the answer from RateU over on mybbhacks.

In the Manage Post Icons in Admin CP, edit each of your post icons, and put something like this in the Image Path field (example for the Big Grin post icons):

images/icons/biggrin.gif" width="16" height="16


Do that for the Smilies too.