PHP Classes

Tempfile problem

Recommend this page to a friend!

      TinyPie  >  All threads  >  Tempfile problem  >  (Un) Subscribe thread alerts  
Subject:Tempfile problem
Summary:one more improvement
Messages:2
Author:Jaroslav
Date:2012-01-04 10:59:53
Update:2012-01-04 13:13:41
 

  1. Tempfile problem   Reply   Report abuse  
Picture of Jaroslav Jaroslav - 2012-01-04 10:59:53
Hi,
your class saves tempfile with constant name on disc.
This can be a problem for dynamic displayed data and multi access.

Please try new code:
private function GetBase64Image()
{
$tempfile = str_replace (' ', '_', microtime());
$this->SaveToFile($tempfile);
$imgbinary = fread(fopen($tempfile, "r"), filesize($tempfile));
@unlink ($tempfile);
return base64_encode($imgbinary);
}

  2. Re: Tempfile problem   Reply   Report abuse  
Picture of David Frendin David Frendin - 2012-01-04 13:13:41 - In reply to message 1 from Jaroslav
That's a great suggestion, I will implement this in the upcoming version.

Thanks you again.