예제 #1
0
파일: helper.php 프로젝트: quyip8818/joomla
 public static function createGrayscaleThumb($path, $type = 'grayscale')
 {
     $myImage = new JImage();
     $myImage->loadFile(JPATH_CACHE . DS . $path);
     if ($myImage->isLoaded()) {
         // $filename = end(explode('/',$path));
         $filename = JFile::getName($path);
         $newfilename = 'gr_' . JFile::makeSafe($filename);
         $fileExists = JFile::exists(JPATH_CACHE . '/' . $newfilename);
         if (!$fileExists) {
             //require_once JPATH_LIBRARIES . DS . 'joomla/image/filters/'.$type.'.php';
             $libfile = JPATH_LIBRARIES . DS . 'joomla/image/filter' . (JVERSION <= 3 ? 's' : '') . '/' . $type . '.php';
             if (JFile::exists($libfile)) {
                 require_once $libfile;
                 $filteredImage = $myImage->filter($type);
                 $filteredImage->toFile(JPATH_CACHE . '/' . $newfilename);
             }
         }
         return $newfilename;
     } else {
         return "My file is not loaded";
     }
 }
예제 #2
0
 /**
  * Test the JImage::filter method without a loaded image.
  *
  * @return  void
  *
  * @expectedException  LogicException
  * @since   11.3
  */
 public function testFilterWithoutLoadedImage()
 {
     // Create a new JImage object without loading an image.
     $image = new JImage();
     $image->filter('negate');
 }