Example #1
0
 /**
  * Here's where are the chacheing get's done.
  * First we need to generate the cache name.
  * Then we need to create the directory path
  * relative to Cache/media, and based off an
  * md5_file($filename).
  */
 private function generateCacheFileName()
 {
     $imageName = JFile::makesafe(basename($this->getFileName()));
     $imageName = JFile::removespace($imageName);
     $imageName = explode('.', $imageName);
     $imageName = str_replace('_', '', $imageName[0]);
     $cacheFileName = $imageName;
     $cacheFileName .= $this->thumbw . 'x' . $this->thumbh;
     $cacheFileName .= '_q' . intval($this->getQuality());
     if ($this->square) {
         $cacheFileName .= '_sq';
     }
     $cacheFileName .= '.jpg';
     $this->broadDirectories = $this->generateCacheDir() . DS;
     $this->cacheFileName = $this->cacheDirectory . $this->broadDirectories . $this->cachePrefix . $cacheFileName;
     return true;
 }