Autodoc
  • Namespace
  • Class
  • Tree

Namespaces

  • BlueTihi
    • Context
  • Brickrouge
    • Element
      • Nodes
    • Renderer
    • Widget
  • ICanBoogie
    • ActiveRecord
    • AutoConfig
    • CLDR
    • Composer
    • Core
    • Event
    • Exception
    • HTTP
      • Dispatcher
      • Request
    • I18n
      • Translator
    • Mailer
    • Modules
      • Taxonomy
        • Support
      • Thumbnailer
        • Versions
    • Object
    • Operation
      • Dispatcher
    • Prototype
    • Routes
    • Routing
      • Dispatcher
    • Session
  • Icybee
    • ActiveRecord
      • Model
    • ConfigOperation
    • Document
    • EditBlock
    • Element
      • ActionbarContextual
      • ActionbarSearch
      • ActionbarToolbar
    • FormBlock
    • Installer
    • ManageBlock
    • Modules
      • Articles
      • Cache
        • Collection
        • ManageBlock
      • Comments
        • ManageBlock
      • Contents
        • ManageBlock
      • Dashboard
      • Editor
        • Collection
      • Files
        • File
        • ManageBlock
      • Forms
        • Form
        • ManageBlock
      • I18n
      • Images
        • ManageBlock
      • Members
      • Modules
        • ManageBlock
      • Nodes
        • ManageBlock
        • Module
      • Pages
        • BreadcrumbElement
        • LanguagesElement
        • ManageBlock
        • NavigationBranchElement
        • NavigationElement
        • Page
        • PageController
      • Registry
      • Search
      • Seo
      • Sites
        • ManageBlock
      • Taxonomy
        • Terms
          • ManageBlock
        • Vocabulary
          • ManageBlock
      • Users
        • ManageBlock
        • NonceLogin
        • Roles
      • Views
        • ActiveRecordProvider
        • Collection
        • View
    • Operation
      • ActiveRecord
      • Constructor
      • Module
      • Widget
    • Rendering
  • None
  • Patron
  • PHP

Classes

  • AdjustImage
  • AdjustThumbnail
  • EditBlock
  • GalleryBlock
  • GalleryController
  • Hooks
  • Image
  • ImageUpload
  • ManageBlock
  • Model
  • Module
  • NodeRelation
  • PopImage
  • PopOrUploadImage
  • SaveOperation
  • Thumbnail
  • ThumbnailDecorator
  • ThumbnailOperation
  • UploadImage
  • UploadOperation
  1 <?php
  2 
  3 /*
  4  * This file is part of the Icybee package.
  5  *
  6  * (c) Olivier Laviale <olivier.laviale@gmail.com>
  7  *
  8  * For the full copyright and license information, please view the LICENSE
  9  * file that was distributed with this source code.
 10  */
 11 
 12 namespace Icybee\Modules\Images;
 13 
 14 use ICanBoogie\Errors;
 15 
 16 use ICanBoogie\Modules\Thumbnailer\Versions;
 17 
 18 class Module extends \Icybee\Modules\Files\Module
 19 {
 20     const ICON_WIDTH = 24;
 21     const ICON_HEIGHT = 24;
 22     const THUMBNAIL_WIDTH = 200;
 23     const THUMBNAIL_HEIGHT = 200;
 24 
 25     static private $thumbnail_versions = array
 26     (
 27         '$icon' => array
 28         (
 29             'w' => self::ICON_WIDTH,
 30             'h' => self::ICON_HEIGHT,
 31             'format' => 'png'
 32         ),
 33 
 34         '$icon-m' => array
 35         (
 36             'w' => 64,
 37             'h' => 64
 38         ),
 39 
 40         '$popimage' => array
 41         (
 42             'w' => 96,
 43             'h' => 96,
 44             'method' => 'surface'
 45         ),
 46 
 47         '$popover' => array
 48         (
 49             'w' => self::THUMBNAIL_WIDTH,
 50             'h' => self::THUMBNAIL_HEIGHT,
 51             'method' => 'surface',
 52             'no-upscale' => true,
 53             'quality' => 90
 54         ),
 55 
 56         '$gallery' => array
 57         (
 58             'w' => 128,
 59             'h' => 128,
 60             'method' => 'constrained',
 61             'quality' => 90
 62         )
 63     );
 64 
 65     /**
 66      * Checks that the thumbnail versions are defined.
 67      */
 68     public function is_installed(Errors $errors)
 69     {
 70         global $core;
 71 
 72         $versions = $core->thumbnailer_versions;
 73 
 74         foreach (self::$thumbnail_versions as $version => $options)
 75         {
 76             if (isset($versions[$version]))
 77             {
 78                 continue;
 79             }
 80 
 81             $errors[$this->id] = $errors->format("Thumbnail version %version is not defined.", array('version' => $version));
 82         }
 83 
 84         return parent::is_installed($errors);
 85     }
 86 
 87     /**
 88      * Define thumbnail versions.
 89      */
 90     public function install(Errors $errors)
 91     {
 92         global $core;
 93 
 94         $versions = $core->thumbnailer_versions;
 95 
 96         foreach (self::$thumbnail_versions as $version => $options)
 97         {
 98             $versions[$version] = $options;
 99         }
100 
101         $versions->save();
102 
103         return parent::install($errors);
104     }
105 }
Autodoc API documentation generated by ApiGen 2.8.0