private function urlPlaceholder($width, $height, $text, $backgroundColor, $textColor, $textSize, $random, array
    $options)
    {
        if ($random) {
            $backgroundColor = $this->getRandomColor();
        }

        $src = 'https://placeholdit.imgix.net/~text?txtsize=' . $textSize . '&bg=' . str_replace('#', '',
                $backgroundColor) . '&txtclr=' . str_replace('#', '', $textColor) . '&txt=' . $text . '&w=' . $width . '&h=' . $height;

        if (!$this->options['placeholder']['cache']) {
            return Html::img($src, $options);
        }

        $cacheFileName = md5($width . $height . $text . $backgroundColor . $textColor . $textSize);
        $cacheFileExt = '.jpg';
        $cacheFileDir = '/' . substr($cacheFileName, 0, 2);
        $cacheFilePath = Yii::getAlias($this->cachePath) . $cacheFileDir;
        $cacheFile = $cacheFilePath . '/' . $cacheFileName . $cacheFileExt;
        $cacheUrl = str_replace('\\', '/', preg_replace('/^@[a-z]+/', '', $this->cachePath) . $cacheFileDir . '/'
            . $cacheFileName . $cacheFileExt);

        if (file_exists($cacheFile)) {
            if ($this->cacheExpire !== 0 && (time() - filemtime($cacheFile)) > $this->cacheExpire) {
                unlink($cacheFile);
            } else {
                return Html::img($cacheUrl, $options);
            }
        }

        if (!is_dir($cacheFilePath)) {
            mkdir($cacheFilePath, 0755, true);
        }

        $image = file_get_contents($src);

        file_put_contents($cacheFile, $image);

        return Html::img($cacheUrl, $options);
    }
private function urlPlaceholder($width, $height, $text, $backgroundColor, $textColor, $textSize, $random, array
    $options)
    {
        if ($random) {
            $backgroundColor = $this->getRandomColor();
        }

        $src = 'https://placeholdit.imgix.net/~text?txtsize=' . $textSize . '&bg=' . str_replace('#', '',
                $backgroundColor) . '&txtclr=' . str_replace('#', '', $textColor) . '&txt=' . $text . '&w=' . $width . '&h=' . $height;

        if (!$this->options['placeholder']['cache']) {
            return Html::img($src, $options);
        }

        $cacheFileName = md5($width . $height . $text . $backgroundColor . $textColor . $textSize);
        $cacheFileExt = '.jpg';
        $cacheFileDir = '/' . substr($cacheFileName, 0, 2);
        $cacheFilePath = Yii::getAlias($this->cachePath) . $cacheFileDir;
        $cacheFile = $cacheFilePath . '/' . $cacheFileName . $cacheFileExt;
        $cacheUrl = str_replace('\\', '/', preg_replace('/^@[a-z]+/', '', $this->cachePath) . $cacheFileDir . '/'
            . $cacheFileName . $cacheFileExt);

        if (file_exists($cacheFile)) {
            if ($this->cacheExpire !== 0 && (time() - filemtime($cacheFile)) > $this->cacheExpire) {
                unlink($cacheFile);
            } else {
                return Html::img($cacheUrl, $options);
            }
        }

        if (!is_dir($cacheFilePath)) {
            mkdir($cacheFilePath, 0755, true);
        }

        $image = file_get_contents($src);

        file_put_contents($cacheFile, $image);

        return Html::img($cacheUrl, $options);
    }
private function urlPlaceholder ( $ width , $ height , $ text , $ backgroundColor , $ textColor , $ textSize , $ random , array $ options ) { if ( $ random ) { $ backgroundColor = $ this -> getRandomColor ( ) ; } $ src = 'https://placeholdit.imgix.net/~text?txtsize=' . $ textSize . '&bg=' . str_replace ( '#' , '' , $ backgroundColor ) . '&txtclr=' . str_replace ( '#' , '' , $ textColor ) . '&txt=' . $ text . '&w=' . $ width . '&h=' . $ height ; if ( ! $ this -> options [ 'placeholder' ] [ 'cache' ] ) { return Html :: img ( $ src , $ options ) ; } $ cacheFileName = md5 ( $ width . $ height . $ text . $ backgroundColor . $ textColor . $ textSize ) ; $ cacheFileExt = '.jpg' ; $ cacheFileDir = '/' . substr ( $ cacheFileName , 0 , 2 ) ; $ cacheFilePath = Yii :: getAlias ( $ this -> cachePath ) . $ cacheFileDir ; $ cacheFile = $ cacheFilePath . '/' . $ cacheFileName . $ cacheFileExt ; $ cacheUrl = str_replace ( '\\' , '/' , preg_replace ( '/^@[a-z]+/' , '' , $ this -> cachePath ) . $ cacheFileDir . '/' . $ cacheFileName . $ cacheFileExt ) ; if ( file_exists ( $ cacheFile ) ) { if ( $ this -> cacheExpire !== 0 && ( time ( ) - filemtime ( $ cacheFile ) ) > $ this -> cacheExpire ) { unlink ( $ cacheFile ) ; } else { return Html :: img ( $ cacheUrl , $ options ) ; } } if ( ! is_dir ( $ cacheFilePath ) ) { mkdir ( $ cacheFilePath , 0755 , true ) ; } $ image = file_get_contents ( $ src ) ; file_put_contents ( $ cacheFile , $ image ) ; return Html :: img ( $ cacheUrl , $ options ) ; }
Return URL placeholder image
@param integer $width
@param integer $height
@param string $text
@param string $backgroundColor
@param string $textColor
@param array $options
@return string
Return URL placeholder image