Exemplo n.º 1
0
 public function getIconImage()
 {
     // This let's us know the type of folder we should lookup to
     $place = JRequest::getString('place');
     // Flat list can only be searched from the root.
     $source = JRequest::getVar('path');
     // @task: Create the media object.
     $media = new EasyBlogMediaManager();
     // @task: Let's find the exact path first as there could be 3 possibilities here.
     // 1. Shared folder
     // 2. User folder
     $absolutePath = EasyBlogMediaManager::getAbsolutePath($source, $place);
     $absoluteURI = EasyBlogMediaManager::getAbsoluteURI($source, $place);
     // @task: Test if the thumbnail exists in the system.
     $basePath = dirname($absolutePath);
     $fileName = basename($absolutePath);
     $iconFileName = EBLOG_SYSTEM_VARIATION_PREFIX . '_icon_' . $fileName;
     $iconFilePath = $basePath . DIRECTORY_SEPARATOR . $iconFileName;
     // @task: Create the thumbnail
     if (!JFile::exists($iconFilePath)) {
         $media->createThumbnail($fileName, $absolutePath, $iconFilePath);
     }
     $info = getimagesize($iconFilePath);
     $this->output($info['mime'], $iconFilePath);
 }