src/Service/Cdn.php
protected function createObject($oData, $bReturnObject = false)
    {
        $aData = [
            'bucket_id'        => $oData->bucket->id,
            'filename'         => $oData->filename,
            'filename_display' => $oData->name,
            'mime'             => $oData->mime,
            'filesize'         => $oData->filesize,
            'md5_hash'         => $oData->md5_hash,
            'driver'           => $this->oEnabledDriver->slug,
        ];

        // --------------------------------------------------------------------------

        if (isset($oData->img->width) && isset($oData->img->height) && isset($oData->img->orientation)) {
            $aData['img_width']       = $oData->img->width;
            $aData['img_height']      = $oData->img->height;
            $aData['img_orientation'] = $oData->img->orientation;
        }

        // --------------------------------------------------------------------------

        //  Check whether file is animated gif
        if ($oData->mime == 'image/gif') {
            if (isset($oData->img->is_animated)) {
                $aData['is_animated'] = $oData->img->is_animated;
            } else {
                $aData['is_animated'] = false;
            }
        }

        // --------------------------------------------------------------------------

        $oObjectModel = Factory::model('Object', 'nails/module-cdn');
        $iObjectId    = $oObjectModel->create($aData);

        if ($iObjectId) {
            return $bReturnObject ? $this->getObject($iObjectId) : $iObjectId;
        } else {
            return false;
        }
    }
protected function createObject($oData, $bReturnObject = false)
    {
        $aData = [
            'bucket_id'        => $oData->bucket->id,
            'filename'         => $oData->filename,
            'filename_display' => $oData->name,
            'mime'             => $oData->mime,
            'filesize'         => $oData->filesize,
            'md5_hash'         => $oData->md5_hash,
            'driver'           => $this->oEnabledDriver->slug,
        ];

        // --------------------------------------------------------------------------

        if (isset($oData->img->width) && isset($oData->img->height) && isset($oData->img->orientation)) {
            $aData['img_width']       = $oData->img->width;
            $aData['img_height']      = $oData->img->height;
            $aData['img_orientation'] = $oData->img->orientation;
        }

        // --------------------------------------------------------------------------

        //  Check whether file is animated gif
        if ($oData->mime == 'image/gif') {
            if (isset($oData->img->is_animated)) {
                $aData['is_animated'] = $oData->img->is_animated;
            } else {
                $aData['is_animated'] = false;
            }
        }

        // --------------------------------------------------------------------------

        $oObjectModel = Factory::model('Object', 'nails/module-cdn');
        $iObjectId    = $oObjectModel->create($aData);

        if ($iObjectId) {
            return $bReturnObject ? $this->getObject($iObjectId) : $iObjectId;
        } else {
            return false;
        }
    }
protected function createObject ( $ oData , $ bReturnObject = false ) { $ aData = [ 'bucket_id' => $ oData -> bucket -> id , 'filename' => $ oData -> filename , 'filename_display' => $ oData -> name , 'mime' => $ oData -> mime , 'filesize' => $ oData -> filesize , 'md5_hash' => $ oData -> md5_hash , 'driver' => $ this -> oEnabledDriver -> slug , ] ; // -------------------------------------------------------------------------- if ( isset ( $ oData -> img -> width ) && isset ( $ oData -> img -> height ) && isset ( $ oData -> img -> orientation ) ) { $ aData [ 'img_width' ] = $ oData -> img -> width ; $ aData [ 'img_height' ] = $ oData -> img -> height ; $ aData [ 'img_orientation' ] = $ oData -> img -> orientation ; } // -------------------------------------------------------------------------- //  Check whether file is animated gif if ( $ oData -> mime == 'image/gif' ) { if ( isset ( $ oData -> img -> is_animated ) ) { $ aData [ 'is_animated' ] = $ oData -> img -> is_animated ; } else { $ aData [ 'is_animated' ] = false ; } } // -------------------------------------------------------------------------- $ oObjectModel = Factory :: model ( 'Object' , 'nails/module-cdn' ) ; $ iObjectId = $ oObjectModel -> create ( $ aData ) ; if ( $ iObjectId ) { return $ bReturnObject ? $ this -> getObject ( $ iObjectId ) : $ iObjectId ; } else { return false ; } }
Creates a new object record in the DB; called from various other methods

@param \stdClass $oData         The data to create the object with
@param boolean   $bReturnObject Whether to return the object, or just it's ID

@return mixed
Creates a new object record in the DB ; called from various other methods