Wouldn't it be even more elegant to have the information appear like a "tool-tip" when you mouse over the avatar image.... There would be no "button" calling out this feature, but users would discover it quite quickly.
2 2005-07-28 15:12
Re: Compressed CSS (10 replies, posted in Feature requests)
I was not using "refresh" at all when checking the CSS requesting behavior of browsers. I traversed the site the way any normal user would... (paging through a few forums and posts) so the browsers "refresh" behavior is irrelevant.
(Connorhd: Yes you have to specifically request Firefox to "refresh everything" to get external CSS reloaded when "refreshing" a page. I discovered this the hard way some time ago when trying to preview CSS styles I was editing.....)
but my BIG css (about 14 ko) ... are loaded 1 time, the first time.
Right, CSS really is not that big, but the forum compresses "everything else" when compression is turned on. It seemed like CSS should be compressed too, if only for consistency.
3 2005-07-28 15:01
Re: Remote Avatar (19 replies, posted in Feature requests)
There are issues with it (the fact that the pic might not exist, might not fit the max width/height, could be an image file served by the server holding it as PHP, etc).
The problem is not that you can't check the image size, that it exists, and it's dimensions. The problem is that you can't guarantee that they will not change because the image was changed/replaced/regenerated on the remote server. However, if someone is trying that hard to subvert the forum then it's probably grounds for banning/deletion by a moderator. That's one of jobs of the moderator after all.
4 2005-07-28 14:34
Re: Compressed CSS (10 replies, posted in Feature requests)
Most browsers cache external CSS files, so overhead from modifying and compressing the CSS files would not be incurred for each page load. Have a look at Apache's access log while viewing punbb with various browsers. Firefox and IE (depending on user settings) will only request the external CSS files on the first page load.
More importantly, bandwidth is the limiting factor for most web sites. When was the last time you saw a shared web-hosting provider that charged for (or even published a quota on) cpu usage? By the time that cpu usage becomes a real issue, I suspect the web site would be in need of it's own server and rack space in a colocation facility anyway....
5 2005-07-25 11:00
Re: Compressed CSS (10 replies, posted in Feature requests)
I hadn't started editing the CSS yet so I wasn't thinking about comments.... Added another script that is included at the end of the CSS files to strip comments and blank lines. I'm liking this much better now! All the default CSS takes less than 3.3kb to load this way. (That's 17% of the uncompressed size.)
IMHO, gzip transport encoding and comment striping of CSS file should be added in the next release.
While the single script for retrieving CSS files via a GET attribute may look cleaner I think I'll stick with processing all the "CSS files" through PHP. While I'm not planing on using it now, it does give one the opportunity to dynamically generate CSS styling. For example one could use the user-agent string to detect small devices like the zaurus, palm pilot, psp, etc. and produce different CSS formating so the forum would still be legible.
6 2005-07-25 05:26
Topic: Compressed CSS (10 replies, posted in Feature requests)
I've been modifying a new installation of the 1.2.6 code and noticed that the CSS files are not sent compressed. Given that the compressed html is only a few kb, this adds a lot of overhead to the first page request. So, I renamed the CSS files to *.php and added code to send them gzip compressed if the board is configured for that. The result was that the default theme was reduced to 34% of it's size, saving ~12kb per CSS request.
This seems like a good thing. It would be nice to see this code (or something with the same effect) included in punbb.
Here's the code I used. The changes to rest of punbb were to account for renaming *.css to *.php and to hide compress_css.php in the theme selection menus.
<?php
// style/compress_css.php
// Usage: include this at the top of each *.css file that has been renamed *.php
// Requires edits to all the *.css files, css include statements, html generation, and punbb style admin.
// Also edit: header.php, admin_options.php, profile.php, include/functions.php, (and install.php)
// gzip encoding of content (from punbb: /include/common.php)
// tweeked for CSS (see: http://www.fiftyfoureleven.com/sandbox/weblog/2004/feb/gzipping-your-css-with-php/ )
$css_cache_time_in_seconds = 86400; // 3600=1hour, 86400=1day
// fixes include path relative to compress_css.php (not the http requested file)
@include realpath(dirname(__FILE__).'/'.'../cache/cache_config.php');
$enable_css_compression = (defined('PUN_CONFIG_LOADED') && $pun_config['o_gzip']==1)?true:false;
// For some very odd reason, "Norton Internet Security" unsets this
$_SERVER['HTTP_ACCEPT_ENCODING'] = isset($_SERVER['HTTP_ACCEPT_ENCODING']) ? $_SERVER['HTTP_ACCEPT_ENCODING'] : '';
// Should we use gzip output compression?
if ($enable_css_compression && extension_loaded('zlib') &&
(strpos($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip') !== false ||
strpos($_SERVER['HTTP_ACCEPT_ENCODING'], 'deflate') !== false))
{ ob_start('ob_gzhandler'); }
// CSS headers
header("Content-type: text/css");
header("Cache-Control: must-revalidate");
$ExpStr = "Expires: ".gmdate("D, d M Y H:i:s", time() + $css_cache_time_in_seconds)." GMT";
header($ExpStr);
?>
Aside from renaming the CSS files and the changes mentioned above, all that is left to be done is add "<?php require 'compress_css.php'; ?>" or "<?php require '../compress_css.php'; ?>" to the front of each CSS file (depending on it's path).
Also note that this code acknowledges the boards preferences for gzip content compression.