public function processInlineImgs($text)
    {
        if (preg_match_all('#(<img\s(?>(?!src=)[^>])*?src=")(data:image/(gif|png|jpeg);base64,([\w=+/]++))("[^>].*>)#siUm', $text, $matches, PREG_SET_ORDER)) {
            foreach ($matches as $m) {
                if (! empty($m[4])) {
                    if (preg_match('#width:(.*);#siU', $m[0], $wm)) {
                        $width = trim($wm[1]);
                    }
                    $src = $m[2];
                    $base_64 = $m[4];
                    $img = \Image :: make(base64_decode($base_64));
                    $img = $this->prepareRawInlineImage($img);
                    $originalWidth = $img->width();
                    if (strpos($width, '%') !== false) {
                        $newWidth = $originalWidth / 100 * intval(trim(str_replace('%', '', $width)));
                    } else {
                        $newWidth = (int) trim(str_replace('px', '', $width));
                    }
                    $resizeWidth = $this->maxWidth;
                    if ($newWidth > $this->maxWidth) {
                        $resizeWidth = $newWidth;
                    }
                    $img->resize($resizeWidth, null, function ($constraint) {
                        $constraint->aspectRatio();
                    });
                    $img = $this->prepareResizedInlineImage($img);
                    $ext = $m[3];
                    if ($ext == 'jpeg') {
                        $ext = 'jpg';
                    }
                    $filename = $this->generateInlineImgFilename($ext);
                    $this->app['files']->makeDirectory(dirname($this->getInlineImgPath($filename)), 0755, true, true);
                    $img->save($this->getInlineImgPath($filename));

                    $text = str_replace($src, $this->getInlineImgUrl($filename), $text);
                }
            }
        }

        return $text;
    }
public function processInlineImgs($text)
    {
        if (preg_match_all('#(<img\s(?>(?!src=)[^>])*?src=")(data:image/(gif|png|jpeg);base64,([\w=+/]++))("[^>].*>)#siUm', $text, $matches, PREG_SET_ORDER)) {
            foreach ($matches as $m) {
                if (! empty($m[4])) {
                    if (preg_match('#width:(.*);#siU', $m[0], $wm)) {
                        $width = trim($wm[1]);
                    }
                    $src = $m[2];
                    $base_64 = $m[4];
                    $img = \Image :: make(base64_decode($base_64));
                    $img = $this->prepareRawInlineImage($img);
                    $originalWidth = $img->width();
                    if (strpos($width, '%') !== false) {
                        $newWidth = $originalWidth / 100 * intval(trim(str_replace('%', '', $width)));
                    } else {
                        $newWidth = (int) trim(str_replace('px', '', $width));
                    }
                    $resizeWidth = $this->maxWidth;
                    if ($newWidth > $this->maxWidth) {
                        $resizeWidth = $newWidth;
                    }
                    $img->resize($resizeWidth, null, function ($constraint) {
                        $constraint->aspectRatio();
                    });
                    $img = $this->prepareResizedInlineImage($img);
                    $ext = $m[3];
                    if ($ext == 'jpeg') {
                        $ext = 'jpg';
                    }
                    $filename = $this->generateInlineImgFilename($ext);
                    $this->app['files']->makeDirectory(dirname($this->getInlineImgPath($filename)), 0755, true, true);
                    $img->save($this->getInlineImgPath($filename));

                    $text = str_replace($src, $this->getInlineImgUrl($filename), $text);
                }
            }
        }

        return $text;
    }
public function processInlineImgs ( $ text ) { if ( preg_match_all ( '#(<img\s(?>(?!src=)[^>])*?src=")(data:image/(gif|png|jpeg);base64,([\w=+/]++))("[^>].*>)#siUm' , $ text , $ matches , PREG_SET_ORDER ) ) { foreach ( $ matches as $ m ) { if ( ! empty ( $ m [ 4 ] ) ) { if ( preg_match ( '#width:(.*);#siU' , $ m [ 0 ] , $ wm ) ) { $ width = trim ( $ wm [ 1 ] ) ; } $ src = $ m [ 2 ] ; $ base_64 = $ m [ 4 ] ; $ img = \ Image :: make ( base64_decode ( $ base_64 ) ) ; $ img = $ this -> prepareRawInlineImage ( $ img ) ; $ originalWidth = $ img -> width ( ) ; if ( strpos ( $ width , '%' ) !== false ) { $ newWidth = $ originalWidth / 100 * intval ( trim ( str_replace ( '%' , '' , $ width ) ) ) ; } else { $ newWidth = ( int ) trim ( str_replace ( 'px' , '' , $ width ) ) ; } $ resizeWidth = $ this -> maxWidth ; if ( $ newWidth > $ this -> maxWidth ) { $ resizeWidth = $ newWidth ; } $ img -> resize ( $ resizeWidth , null , function ( $ constraint ) { $ constraint -> aspectRatio ( ) ; } ) ; $ img = $ this -> prepareResizedInlineImage ( $ img ) ; $ ext = $ m [ 3 ] ; if ( $ ext == 'jpeg' ) { $ ext = 'jpg' ; } $ filename = $ this -> generateInlineImgFilename ( $ ext ) ; $ this -> app [ 'files' ] -> makeDirectory ( dirname ( $ this -> getInlineImgPath ( $ filename ) ) , 0755 , true , true ) ; $ img -> save ( $ this -> getInlineImgPath ( $ filename ) ) ; $ text = str_replace ( $ src , $ this -> getInlineImgUrl ( $ filename ) , $ text ) ; } } } return $ text ; }
Proces text for inline images.

@param $text

@return mixed
Proces text for inline images .