OXID eShop CE  4.9.9
 All Classes Files Functions Variables Pages
oxDynImgGenerator Class Reference
+ Collaboration diagram for oxDynImgGenerator:

Public Member Functions

 __call ($sMethod, $aArgs)
 getImagePath ($sAbsPath=false)
 outputImage ()

Static Public Member Functions

static getInstance ()

Protected Member Functions

 _getShopBasePath ()
 _getImageUri ()
 _getImageName ()
 _getImageMasterPath ()
 _getImageInfo ()
 _getImageTarget ()
 _getNopicImageTarget ()
 _getImageType ()
 _generatePng ($sSource, $sTarget, $iWidth, $iHeight)
 _generateJpg ($sSource, $sTarget, $iWidth, $iHeight, $iQuality)
 _generateGif ($sSource, $sTarget, $iWidth, $iHeight)
 _isTargetPathValid ($sPath)
 _createFolders ($sDir)
 _isValidPath ($sPath)
 _generateImage ($sImageSource, $sImageTarget)
 _getLockName ($sName)
 _lock ($sSource)
 _unlock ($sSource)
 _setHeader ($sHeader)
 _getHeaders ()

Protected Attributes

 $_aHeaders = array()
 $_aAllowedImgTypes = array("jpg", "jpeg", "png", "gif")
 $_sImageInfoSep = "_"
 $_hLockHandle = null
 $_sImageUri = null
 $_aConfParamToPath

Static Protected Attributes

static $_oInstance = null

Detailed Description

Image generator class

Definition at line 106 of file oxdynimggenerator.php.

Member Function Documentation

oxDynImgGenerator::__call (   $sMethod,
  $aArgs 
)

Only used for convenience in UNIT tests by doing so we avoid writing extended classes for testing protected or private methods

Parameters
string$sMethodMethods name
array$aArgsArgument array
Exceptions
oxSystemComponentExceptionThrows an exception if the called method does not exist or is not accessable in current class
Returns
string

Definition at line 198 of file oxdynimggenerator.php.

oxDynImgGenerator::_createFolders (   $sDir)
protected

Checks if valid and creates missing needed folders

Parameters
string$sDirfolder(s) to create
Returns
bool

Definition at line 400 of file oxdynimggenerator.php.

oxDynImgGenerator::_generateGif (   $sSource,
  $sTarget,
  $iWidth,
  $iHeight 
)
protected

Generates GIF type image and returns its location on file system

Parameters
string$sSourceimage source
string$sTargetimage target
int$iWidthimage width
int$iHeightimage height
Returns
string

Definition at line 364 of file oxdynimggenerator.php.

oxDynImgGenerator::_generateImage (   $sImageSource,
  $sImageTarget 
)
protected

Generates requested image

Parameters
string$sImageSourceimage source
string$sImageTargetimage target
Returns
string

Definition at line 518 of file oxdynimggenerator.php.

oxDynImgGenerator::_generateJpg (   $sSource,
  $sTarget,
  $iWidth,
  $iHeight,
  $iQuality 
)
protected

Generates JPG type image and returns its location on file system

Parameters
string$sSourceimage source
string$sTargetimage target
int$iWidthimage width
int$iHeightimage height
int$iQualitynew image quality
Returns
string

Definition at line 349 of file oxdynimggenerator.php.

oxDynImgGenerator::_generatePng (   $sSource,
  $sTarget,
  $iWidth,
  $iHeight 
)
protected

Generates PNG type image and returns its location on file system

Parameters
string$sSourceimage source
string$sTargetimage target
int$iWidthimage width
int$iHeightimage height
Returns
string

Definition at line 333 of file oxdynimggenerator.php.

oxDynImgGenerator::_getHeaders ( )
protected

Returs headers array

Returns
array

Definition at line 725 of file oxdynimggenerator.php.

oxDynImgGenerator::_getImageInfo ( )
protected

Returns image info array

Returns
array

Definition at line 278 of file oxdynimggenerator.php.

oxDynImgGenerator::_getImageMasterPath ( )
protected

Returns path to possible master image

Returns
string

Definition at line 261 of file oxdynimggenerator.php.

oxDynImgGenerator::_getImageName ( )
protected

Returns requested image name

Returns
string

Definition at line 251 of file oxdynimggenerator.php.

oxDynImgGenerator::_getImageTarget ( )
protected

Returns full requested image path on file system

Returns
string

Definition at line 293 of file oxdynimggenerator.php.

oxDynImgGenerator::_getImageType ( )
protected

Returns image type used for image generation and header setting

Returns
string

Definition at line 315 of file oxdynimggenerator.php.

oxDynImgGenerator::_getImageUri ( )
protected

Returns requested image uri

Returns
string

Definition at line 227 of file oxdynimggenerator.php.

oxDynImgGenerator::_getLockName (   $sName)
protected

Returns lock file name

Parameters
string$sNameoriginal file name
Returns
string

Definition at line 564 of file oxdynimggenerator.php.

oxDynImgGenerator::_getNopicImageTarget ( )
protected

Nopic image path

Returns
string

Definition at line 303 of file oxdynimggenerator.php.

oxDynImgGenerator::_getShopBasePath ( )
protected

Returns shops base path

Returns
string

Definition at line 217 of file oxdynimggenerator.php.

oxDynImgGenerator::_isTargetPathValid (   $sPath)
protected

Checks if requested image path is valid. If path is valid but is not created - creates directory structure

Parameters
string$sPathimage path name to check
Returns
bool

Definition at line 379 of file oxdynimggenerator.php.

oxDynImgGenerator::_isValidPath (   $sPath)
protected

Checks if main folder matches requested

Parameters
string$sPathimage path name to check
Returns
bool

Definition at line 433 of file oxdynimggenerator.php.

oxDynImgGenerator::_lock (   $sSource)
protected

Locks file and returns locking state

Parameters
string$sSourcesource file which should be locked
Returns
bool

Definition at line 576 of file oxdynimggenerator.php.

oxDynImgGenerator::_setHeader (   $sHeader)
protected

Custom header setter

Parameters
string$sHeaderheader

Definition at line 715 of file oxdynimggenerator.php.

oxDynImgGenerator::_unlock (   $sSource)
protected

Deletes lock file

Parameters
string$sSourcesource file which should be locked

Definition at line 608 of file oxdynimggenerator.php.

oxDynImgGenerator::getImagePath (   $sAbsPath = false)

Returns path to image file which needs should be rendered. If file cannot be found - return false

Parameters
string$sAbsPathabsolute requested image path (not url, but real path on file system)
Returns
string | false

Definition at line 625 of file oxdynimggenerator.php.

static oxDynImgGenerator::getInstance ( )
static

Creates and returns picture generator instance

Returns
oxDynImgGenerator

Definition at line 177 of file oxdynimggenerator.php.

oxDynImgGenerator::outputImage ( )

Creates and outputs requested image. If source file was not found - tries to render related "nopic.jpg". If "nopic.jpg" is not available - sends 404 header to browser

Definition at line 672 of file oxdynimggenerator.php.

Member Data Documentation

oxDynImgGenerator::$_aAllowedImgTypes = array("jpg", "jpeg", "png", "gif")
protected

Definition at line 128 of file oxdynimggenerator.php.

oxDynImgGenerator::$_aConfParamToPath
protected
Initial value:
array(
"sIconsize" => '/.*\/generated\/product\/(icon|\d+)\/\d+\_\d+\_\d+$/',
"sThumbnailsize" => '/.*\/generated\/product\/(thumb|\d+)\/\d+\_\d+\_\d+$/',
"sZoomImageSize" => '/.*\/generated\/product\/\d+\/\d+\_\d+\_\d+$/',
"aDetailImageSizes" => '/.*\/generated\/product\/\d+\/\d+\_\d+\_\d+$/',
"sManufacturerIconsize" => '/.*\/generated\/(manufacturer|vendor)\/icon\/\d+\_\d+\_\d+$/',
"sCatThumbnailsize" => '/.*\/generated\/category\/thumb\/\d+\_\d+\_\d+$/',
"sCatIconsize" => '/.*\/generated\/category\/icon\/\d+\_\d+\_\d+$/',
"sCatPromotionsize" => '/.*\/generated\/category\/promo_icon\/\d+\_\d+\_\d+$/'
)

Definition at line 157 of file oxdynimggenerator.php.

oxDynImgGenerator::$_aHeaders = array()
protected

Definition at line 121 of file oxdynimggenerator.php.

oxDynImgGenerator::$_hLockHandle = null
protected

Definition at line 143 of file oxdynimggenerator.php.

oxDynImgGenerator::$_oInstance = null
staticprotected

Definition at line 114 of file oxdynimggenerator.php.

oxDynImgGenerator::$_sImageInfoSep = "_"
protected

Definition at line 136 of file oxdynimggenerator.php.

oxDynImgGenerator::$_sImageUri = null
protected

Definition at line 150 of file oxdynimggenerator.php.


The documentation for this class was generated from the following file: