BEdita API doc | 4-cactus
  • Class
  • Tree
  • Deprecated
  • Download

Classes

  • Addon
  • AddressbookController
  • AddressbookShell
  • AdminController
  • Alias
  • Annotation
  • ApiAuthComponent
  • ApiBaseController
  • ApiFormatterComponent
  • ApiUploadComponent
  • ApiValidatorComponent
  • AppController
  • AppError
  • AppHelper
  • Application
  • AppModel
  • Area
  • AreasController
  • Audio
  • AuthenticationsController
  • BannedIp
  • BEAppModel
  • BEAppObjectModel
  • BeAuthComponent
  • BeAuthFacebookComponent
  • BeAuthGoogleComponent
  • BeAuthTwitterComponent
  • BeCallbackManager
  • BeConfigure
  • BeCustomPropertyComponent
  • BeditaAnnotationModel
  • BeditaBaseShell
  • BeditaCollectionModel
  • BeditaContentModel
  • BeditaExportFilter
  • BeditaImportFilter
  • BeditaObjectModel
  • BeditaProductModel
  • BeditaShell
  • BeditaSimpleObjectModel
  • BeditaSimpleStreamModel
  • BeditaStreamModel
  • BeEmbedFlashHelper
  • BeEmbedHtml5Helper
  • BeEmbedMediaHelper
  • BeErrorCode
  • BeExceptionHandler
  • BEFile
  • BeFileHandlerComponent
  • BeFormHelper
  • BeFrontHelper
  • BeHashComponent
  • BeHtmlHelper
  • BeLangTextComponent
  • BeLib
  • BeMailComponent
  • BEObject
  • BeObjectCache
  • BePaginatorToolbarHelper
  • BeSchema
  • BeSecurityComponent
  • BeSystem
  • BeSystemComponent
  • BeThumb
  • BeTimeHelper
  • BeToolbarHelper
  • BeTreeComponent
  • BeTreeHelper
  • BeUploadToObjComponent
  • BeurlHelper
  • BeVimeoComponent
  • BeYoutubeComponent
  • BuildFilterBehavior
  • CacheableBehavior
  • CacheShell
  • CallbackBehavior
  • CaptchaComponent
  • Caption
  • CaptionsBehavior
  • Card
  • CardsImportFilter
  • Category
  • CleanupDataTask
  • CleanupTask
  • Comment
  • CommentsController
  • CompactResultBehavior
  • Content
  • CreateIndexFieldsBehavior
  • DataShell
  • DataTransfer
  • DateItem
  • DbadminShell
  • DeleteDependentObjectBehavior
  • DeleteObjectBehavior
  • DeployShell
  • Document
  • DocumentsController
  • DumpModel
  • EditorialContentsShell
  • EditorNote
  • Event
  • EventLog
  • EventsController
  • FilesController
  • ForeignDependenceSaveBehavior
  • FrontendController
  • FrontendShell
  • GalleriesController
  • Gallery
  • GeoTag
  • GettextShell
  • Git
  • GravatarHelper
  • Group
  • HashJob
  • History
  • HomeController
  • Image
  • ImageInfoHelper
  • JsonExportFilter
  • JsonImportFilter
  • JsonView
  • LangText
  • Link
  • MailGroup
  • MailGroupCard
  • MailJob
  • MailLog
  • MailMessage
  • MailShell
  • MailTemplate
  • Mask
  • MediaShell
  • MigrateDumpModel
  • MigrateShell
  • Migration
  • MigrationBase
  • MigrationDateItemsShell
  • Module
  • ModulesController
  • ModuleShell
  • MultimediaController
  • NewsController
  • NewsletterController
  • NewsletterShell
  • NotifyBehavior
  • ObjectEditor
  • ObjectProperty
  • ObjectRelation
  • ObjectType
  • ObjectUser
  • PagesController
  • Permission
  • PermissionModule
  • PermsHelper
  • Product
  • Property
  • PropertyOption
  • PublicationShell
  • RedisShell
  • RelationCheck
  • RelationRepair
  • RelationShell
  • RelationStats
  • RemoveDummyNameBehavior
  • ResponseHandlerComponent
  • RestClientModel
  • Revision
  • RevisionObjectBehavior
  • SearchText
  • SearchTextSaveBehavior
  • Section
  • SectionDummy
  • SessionFilterComponent
  • SessionFilterHelper
  • ShortNews
  • SmartyView
  • SoapClientModel
  • SplitterSql
  • StatisticsController
  • Stream
  • StreamLog
  • StreamsController
  • Svn
  • TagsController
  • ThemeSmartyView
  • ThumbnailHelper
  • ThumbShell
  • TransactionComponent
  • TransactionFS
  • TranslationsController
  • Tree
  • TrHelper
  • User
  • UserProperty
  • UsersController
  • Utility
  • Version
  • Video
  • VimeoHelper
  • WebmarksController
  • XmlExportFilter
  • XmlImportFilter
  • XmlJsonConverter
  • XmlView
  • YoutubeHelper

Interfaces

  • ApiAuthInterface
  • MediaProviderInterface
  • UploadableInterface

Exceptions

  • BeditaAjaxException
  • BEditaAllowURLException
  • BeditaBadRequestException
  • BeditaConflictException
  • BEditaDeleteStreamObjException
  • BeditaException
  • BEditaFileExistException
  • BeditaForbiddenException
  • BeditaFrontAccessException
  • BeditaHashException
  • BEditaInfoException
  • BeditaInternalErrorException
  • BEditaIOException
  • BeditaLengthRequiredException
  • BeditaMailException
  • BEditaMediaProviderException
  • BeditaMethodNotAllowedException
  • BEditaMIMEException
  • BeditaNotFoundException
  • BeditaNotImplementedException
  • BeditaPublicationException
  • BeditaRuntimeException
  • BEditaSaveStreamObjException
  • BeditaServiceUnavailableException
  • BeditaUnauthorizedException
  • BEditaUploadPHPException
  • BEditaURLException

Class BeThumb

Thumbnail utilities class

Located at libs/be_thumb.php

Methods summary

public
# __construct( )
public
# getValidImplementations( )
private
# reset( )

Reset internal arrays

Reset internal arrays

public
# image( $data, $params = array(), $skipCheck = false )

Returns image URI after resample (thumbnail version of the input image data provided) Creates thumbnail image in $config['mediaRoot']/cache dir if thumb not created or outdated If a cache configuration 'thumbs' is found presence check is done through cache and not on filesystem (S3 optimization)

Returns image URI after resample (thumbnail version of the input image data provided) Creates thumbnail image in $config['mediaRoot']/cache dir if thumb not created or outdated If a cache configuration 'thumbs' is found presence check is done through cache and not on filesystem (S3 optimization)

Param:

array $data, required, source image data (may be BE media object or other source) - required "uri"

array $params extra info about $params:

    width, height, longside, optional: [integer]
    if no parameters is set, use default width & height in bedita.ini.php (['image']['thumbWidth'], ['image']['thumbHeight'])
    if longside is set, width & height are ignored and mode is forced to resize.
    if only width or only height is specified, the mode and modeparam are ignored and forced to 'resize'.

    mode, optional: [crop, croponly, resize, 'fill', 'stretch']
    if not specified default bedita.ini.php (['image']['thumbMode']) is used (but always overrided by the rules above).
    'fill' is legacy options: it will set mode always to 'resize' but modeparam to 'fill' only if longside is not set.
    'stretch' is legacy options: it will set mode always to 'resize' and modeparam to 'stretch'.

    modeparam, optional: [fill, stretch, 'C', 'T', 'B', 'L', 'R', 'TL', 'TR', 'BL', 'BR']
    depends on mode:
        if resize: 'fill' or 'stretch' and if left empty do simple resize.
        if crop, a string describing crop zone 'C', 'T', 'B', 'L', 'R', 'TL', 'TR', 'BL', 'BR' (default: ['image']['thumbCrop'] )

    cache, optional: [true, false]
    allow the caching of images, default in bedita.ini (['image']['cache'] )

    bgcolor, optional: [string]
    string representing hex color, i.e. 'FFFFFF' for the background (only on mode=resize and modeparam=fill)
    default in bedita.ini (['image']['background'] )

    upscale, optional: [true, false]
    allow or not upscale. default bedita.ini.php (['image']['thumbUpscale'])

    type, optional: ['gif'/'png'/'jpg']
    force image target type (default the same as original)

    watermark, optional: [array: 'text', 'font', 'fontSize', 'textColor', 'background', 'file', 'align', 'opacity' ]
    add simple watermark to image, the missing parameters are replaced with the defaults in bedita.ini (['image']['wmi']* )

boolean $skipCheck, if true don't perform thumbnail presence check and creation but returns URL immediately

Return:

string, resampled and cached image URI (using $html helper)
protected boolean
# setupImagePath( array & $data )

Setup source image path and remote flag

Setup source image path and remote flag

Parameters

$data

Returns

boolean
Success.
public true
# setupImageInfo( array & $data )

Setup internal imageInfo data array On error $data['error'] is populated with: - 'notFund' if image is missing or unreachable - 'unsupported' if image format is not supported

Setup internal imageInfo data array On error $data['error'] is populated with: - 'notFund' if image is missing or unreachable - 'unsupported' if image format is not supported

Parameters

$data

Returns

true
on success, false on error
public
# imagePathCached( $imageFilePath = null )

Get image file path, get cached local copy behind a proxy

Get image file path, get cached local copy behind a proxy

private
# cacheImageInfoFilePath( )

Get internal img info cache file name

Get internal img info cache file name

private
# remoteImageCachePathProxy( )

Read cached image (i.e. if under proxy)

Read cached image (i.e. if under proxy)

private array
# readCacheImageInfo( )

Read cached img info, if present

Read cached img info, if present

Returns

array
private
# storeCacheImageInfo( )

Store img info in cache (file or engine(

Store img info in cache (file or engine(

private
# storeCacheThumbnail( $cacheItem )

Store cache thumbnail item

Store cache thumbnail item

public
# thumbnailSize( unknown $thumbPath )

Get thumbnail size in bytes reading from cache or filsystem Input thumbnail path should be relative to media root (not includin media root) May use cached data

Get thumbnail size in bytes reading from cache or filsystem Input thumbnail path should be relative to media root (not includin media root) May use cached data

Parameters

$thumbPath
private
# setupImageTarget( )

Setup internal imageTarget data array, used in thumbnails creation

Setup internal imageTarget data array, used in thumbnails creation

private boolean
# resample( )

Resample image using PhpThumb

Resample image using PhpThumb

Returns

boolean
private boolean
# checkSourceFile( )

Check source file existence/correctness

Check source file existence/correctness

Returns

boolean
private string
# targetFileName( )

Build target filename

Build target filename

Returns

string
private boolean
# checkCacheDirectory( )

Check target cache directory existence and create it if missing

Check target cache directory existence and create it if missing

Returns

boolean
private string
# checkLocalThumbCacheDirectory( )

Check local thumb target cache directory existence and create it if missing

Check local thumb target cache directory existence and create it if missing

Returns

string
private array
# getCropCoordinates( integer $origW, integer $origH, integer $targetW, integer $targetH, string $position )

calculate cropping coordinates (top, left)

calculate cropping coordinates (top, left)

Parameters

$origW
$origW, original width
$origH
$origH, original height
$targetW
$targetW, target object width
$targetH
$targetH, target object height
$position
$position: TL (top left), T (top), TR (top right), L (left), R (right), BL (bottom left), B (bottom), BR (bottom right), C (center), default center

Returns

array
private
# triggerError( string $errorMsg )

Log/report error

Log/report error

Parameters

$errorMsg
private
# log( string $msg, $type )

Log/report error

Log/report error

Parameters

$msg
$errorMsg
$type
private boolean
# isAnimatedGif( )

Check whether current image is an animated GIF.

Check whether current image is an animated GIF.

Returns

boolean

See

http://php.net/manual/en/function.imagecreatefromgif.php#59787
protected boolean
# isExceedingSize( integer $size )

Check whether file size is exceeding size limits for image thumbnail generation.

Check whether file size is exceeding size limits for image thumbnail generation.

Parameters

$size
File size.

Returns

boolean
private string
# mimeTypeByExtension( $ext )

Mime type by file extension

Mime type by file extension

Parameters

$ext
extension

Returns

string
or false if mime_type not found

Properties summary

private array $supportedTypes
# array( 'image/gif' => 'gif', 'image/jpeg' => 'jpg', 'image/pjpeg' => 'jpg', 'image/png' => 'png', 'image/svg+xml' => 'svg' )
private array $imageInfo

Source image data

Source image data

# array()
private array $imageTarget

Target image data (thumbnail)

Target image data (thumbnail)

# array()
private $imgMissingFile

Link to "missing image" url img (could be different in backend o frontend)

Link to "missing image" url img (could be different in backend o frontend)

# null
private $imgUnsupported

Link to "unsupported mime" url image (could be different in backend o frontend)

Link to "unsupported mime" url image (could be different in backend o frontend)

# null
private $mediaRoot

Path to BEdita media root

Path to BEdita media root

# null
private $localThumbRoot

Path to local root folder used for writing thumbs if null $this->mediaRoot is used

Path to local root folder used for writing thumbs if null $this->mediaRoot is used

# null
private array $inputParams

Input params passed to image() method gor thumb creation

Input params passed to image() method gor thumb creation

# array()
public array $allowedParams

List of allowed input params

List of allowed input params

# array( 'width', 'height', 'fillcolor', 'longside', 'mode', 'modeparam', 'type', 'upscale', 'cache', 'watermark', 'quality', 'interlace', )
public array $ignoredParams

List of input params to ignore

List of input params to ignore

# array('presentation', 'URLonly')
private array $knownMimeTypes

All known mime types internal use (if needed), read from config/mime.types.php

All known mime types internal use (if needed), read from config/mime.types.php

# array()
private boolean|null $cacheDirChecked

It says if cache dir for thumbnail has been already checked and created. Its value is null when it hasn't evaluated yet.

It says if cache dir for thumbnail has been already checked and created. Its value is null when it hasn't evaluated yet.

# null
BEdita API doc | 4-cactus API documentation generated by ApiGen