Ejemplo n.º 1
0
 /**
  * Checks, if the cache has the given file
  * @param  string  $file     The filename
  * @param  int     $lifetime Lifetime of the file in cache
  * @return boolean false if not found
  */
 public static function has($file, $lifetime = 0)
 {
     static::loadConfig();
     $lifetime = $lifetime > 0 ? $lifetime : static::$cache_lifetime;
     $file = static::$cache_path . $file;
     if (File::exists($file)) {
         $filemtime = filemtime($file);
         if ($filemtime + $lifetime < time()) {
             File::delete($file);
             return false;
         }
         return true;
     }
 }
Ejemplo n.º 2
0
 /**
  * Get a created placeholdr image content.
  *
  * @param  integer  $width
  * @param  integer $height
  * @param  string  $text
  * @return string
  */
 public function get($width, $height = 0, $text = '')
 {
     if (!($image_file = $this->make($width, $height, $text))) {
         throw new Exception('Failed to create placeholdr.');
     }
     // Get image file contents
     $image_file_contents = File::get($image_file);
     if (Config::get('placeholdr::placeholdr.gd.save_created_placeholdrs') !== true) {
         File::delete($image_file);
     }
     return $image_file_contents;
 }