thesaint704,
I have an application that generates monthly graphs. In my view that
generates the graph (graph.ctp), I cache the results. Subsequent
calls will get the image from cache. What I have in the views, is
something like this.
view.ctp:
----------
<img src='<?php echo Router::url(array(
'controller'=>'adsense',
'action'=>'graph',
'month'=>$month,
'year'=>$year,
)); ?>' />
in the graph action, data is fetched, and an image is generated in the
view. If an image was recently created, it will be used instead of
producing another one.
graph.ctp:
----------
$cacheKey='chart_graph_'.base64_encode(serialize(compact
('month','year')));
$image=base64_decode(Cache::read($cacheKey));
if(!$image){
ob_start();
require_once 'Image/Graph.php';
//
// Make the image
//
$image = ob_get_contents();
ob_end_clean();
Cache::write($cacheKey,base64_encode($image),"+1 day");
}
echo $image;
I hope this helps at some level or another.
-teh
On May 30, 11:43 am, "[email protected]"
<[email protected]> wrote:
> I have a php script that produces a final product with a png image
> plus interpretation and other calculations, is there any way that at
> the same time that produces de final page also would produce a copy
> and save it in my server, for example in a folder "customers/"?
>
> Thank you very much for your help.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---