pChart 2.x forum
http://wiki.pchart.net/forum/

.htaccess docs.
http://wiki.pchart.net/forum/viewtopic.php?f=3&t=63
Page 1 of 1

Author:  absenm [ Sat Jan 08, 2011 6:16 pm ]
Post subject:  .htaccess docs.

Wow, I'm really liking pCharts. It's exactly what I've been looking for. My site uses a ton of charts, and for almost two years I've been using a Flash based system. But I don't trust Flash, plus it isn't compatible with iDevices and therefore my site wasn't useful on iPhones and iPads. I tinkered around with HTML5, but that meant the use of JavaScript and clientside rendering, which meant differences in browsers could cause rendering problems, and the data points were not secure from scrapping bots. Anyway.

While setting up my site, which is fairly dynamic, I really needed to be concerned with browser/proxy caching. I do know you have a built in system to do some caching. But my site design is very advanced, and upwards of 5000 charts could potentially be used. So I needed something a little more robust when it comes to caching. So I did a ton of research and learned a bunch about using .htaccess files to shorten how long a browser would cache images. I have mine set to a half hour for any images in my charts folder. Maybe you, or one of your supporters, could document somewhere some basic .htaccess codes for browser caching purposes.

I also use a custom system of checking file modification dates, and then don't have the charts recreated unless they are older than a half hour. This is to keep server processing times down. Something a little like the code below.

Quote:
$filename = $chartimage;
if ((file_exists($filename)) && ((mktime() - filemtime($filename)) < 1800)) {
//echo "New. Do nothing.";
} else {
//echo "Old. Make new";
$myData = new pData();

// Bla Bla Bla pChart code goes here
}
$myPicture->Render("$chartimage");


Anyway, that keeps processing time within reason, while still having reasonably up to date charts. Just wanted share these ideas, and make the .htaccess documentation suggestion. I'd be happy do provide you a link to my site that you could use for demo purposes, but didn't want to place it on your forums without your permission.

Page 1 of 1 All times are UTC
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/