コード例 #1
0
ファイル: Image.php プロジェクト: ExchangeCore/razor-commerce
 public function install_thumbnail_types()
 {
     $thumbnail_types = array('product_full' => array('name' => 'Product Full', 'width' => 600), 'product_full_thumbnail' => array('name' => 'Product Full Thumbnail', 'width' => 600, 'height' => 600), 'product_medium' => array('name' => 'Product Medium', 'width' => 300), 'product_medium_thumbnail' => array('name' => 'Product Medium Thumbnail', 'width' => 300, 'height' => 300), 'product_small' => array('name' => 'Product Small', 'width' => 150), 'product_small_thumbnail' => array('name' => 'Product Small Thumbnail', 'width' => 150, 'height' => 150));
     foreach ($thumbnail_types as $handle => $type) {
         $thumbnailType = new ThumbnailType();
         $thumbnailType->requireType();
         $thumbnailType->setHandle($handle);
         $thumbnailType->setName($type['name']);
         $thumbnailType->setWidth($type['width']);
         if (isset($type['height'])) {
             $thumbnailType->setHeight($type['height']);
         }
         $thumbnailType->save();
     }
 }
コード例 #2
0
 public function import_files()
 {
     $type = \Concrete\Core\File\StorageLocation\Type\Type::add('default', t('Default'));
     \Concrete\Core\File\StorageLocation\Type\Type::add('local', t('Local'));
     $configuration = $type->getConfigurationObject();
     $fsl = \Concrete\Core\File\StorageLocation\StorageLocation::add($configuration, t('Default'), true);
     $thumbnailType = new Type();
     $thumbnailType->requireType();
     $thumbnailType->setName(tc('ThumbnailTypeName', 'File Manager Thumbnails'));
     $thumbnailType->setHandle(Config::get('concrete.icons.file_manager_listing.handle'));
     $thumbnailType->setWidth(Config::get('concrete.icons.file_manager_listing.width'));
     $thumbnailType->setHeight(Config::get('concrete.icons.file_manager_listing.height'));
     $thumbnailType->save();
     $thumbnailType = new Type();
     $thumbnailType->requireType();
     $thumbnailType->setName(tc('ThumbnailTypeName', 'File Manager Detail Thumbnails'));
     $thumbnailType->setHandle(Config::get('concrete.icons.file_manager_detail.handle'));
     $thumbnailType->setWidth(Config::get('concrete.icons.file_manager_detail.width'));
     $thumbnailType->save();
     if (is_dir($this->getPackagePath() . '/files')) {
         $ch = new ContentImporter();
         $computeThumbnails = true;
         if ($this->contentProvidesFileThumbnails()) {
             $computeThumbnails = false;
         }
         $ch->importFiles($this->getPackagePath() . '/files', $computeThumbnails);
     }
 }
コード例 #3
0
ファイル: thumbnails.php プロジェクト: digideskio/concrete5
 public function do_add()
 {
     $request = $this->validateThumbnailRequest();
     if (!Loader::helper('validation/token')->validate('do_add')) {
         $this->error->add(Loader::helper('validation/token')->getErrorMessage());
     }
     if (!$this->error->has()) {
         $type = new Type();
         $height = intval($request->request->get('ftTypeHeight'));
         if ($height > 0) {
             $type->setHeight($request->request->get('ftTypeHeight'));
         }
         $type->setWidth($request->request->get('ftTypeWidth'));
         $type->setName($request->request->get('ftTypeName'));
         $type->setHandle($request->request->get('ftTypeHandle'));
         $type->save();
         $this->redirect('/dashboard/system/files/thumbnails', 'thumbnail_type_added');
     }
     $this->set('type', $type);
 }
コード例 #4
0
 public function import_files()
 {
     $type = \Concrete\Core\File\StorageLocation\Type\Type::add('default', t('Default'));
     \Concrete\Core\File\StorageLocation\Type\Type::add('local', t('Local'));
     $configuration = $type->getConfigurationObject();
     $fsl = \Concrete\Core\File\StorageLocation\StorageLocation::add($configuration, t('Default'), true);
     $thumbnailType = new Type();
     $thumbnailType->requireType();
     $thumbnailType->setName(tc('ThumbnailTypeName', 'File Manager Thumbnails'));
     $thumbnailType->setHandle(\Config::get('concrete.icons.file_manager_listing.handle'));
     $thumbnailType->setWidth(\Config::get('concrete.icons.file_manager_listing.width'));
     $thumbnailType->setHeight(\Config::get('concrete.icons.file_manager_listing.height'));
     $thumbnailType->save();
     $thumbnailType = new Type();
     $thumbnailType->requireType();
     $thumbnailType->setName(tc('ThumbnailTypeName', 'File Manager Detail Thumbnails'));
     $thumbnailType->setHandle(\Config::get('concrete.icons.file_manager_detail.handle'));
     $thumbnailType->setWidth(\Config::get('concrete.icons.file_manager_detail.width'));
     $thumbnailType->save();
     if (is_dir($this->getPackagePath() . '/files')) {
         $fh = new FileImporter();
         $contents = Loader::helper('file')->getDirectoryContents($this->getPackagePath() . '/files');
         foreach ($contents as $filename) {
             $f = $fh->import($this->getPackagePath() . '/files/' . $filename, $filename);
         }
     }
 }
 /**
  * {@inheritDoc}
  */
 public function setHeight($ftTypeHeight)
 {
     $this->__initializer__ && $this->__initializer__->__invoke($this, 'setHeight', array($ftTypeHeight));
     return parent::setHeight($ftTypeHeight);
 }