public function getPreviews($html)
    {
        $images = array_map(function ($url) {
            if ($url && !is_url($url)) {
                //If is relative path
                $url = Folder::isAbsolute($url) ? $url : WWW_ROOT . 'img' . DS . $url;

                if (!file_exists($url)) {
                    return false;
                }

                $thumber = new ThumbCreator($url);
                $thumber->resize(1200, 1200)->save(['format' => 'jpg']);
                $url = $thumber->getUrl();
            }

            list($width, $height) = $this->getPreviewSize($url);

            return new Entity(compact('url', 'width', 'height'));
        }, $this->extractImages($html));

        return array_filter($images);
    }
public function getPreviews($html)
    {
        $images = array_map(function ($url) {
            if ($url && !is_url($url)) {
                //If is relative path
                $url = Folder::isAbsolute($url) ? $url : WWW_ROOT . 'img' . DS . $url;

                if (!file_exists($url)) {
                    return false;
                }

                $thumber = new ThumbCreator($url);
                $thumber->resize(1200, 1200)->save(['format' => 'jpg']);
                $url = $thumber->getUrl();
            }

            list($width, $height) = $this->getPreviewSize($url);

            return new Entity(compact('url', 'width', 'height'));
        }, $this->extractImages($html));

        return array_filter($images);
    }
public function getPreviews ( $ html ) { $ images = array_map ( function ( $ url ) { if ( $ url && ! is_url ( $ url ) ) { //If is relative path $ url = Folder :: isAbsolute ( $ url ) ? $ url : WWW_ROOT . 'img' . DS . $ url ; if ( ! file_exists ( $ url ) ) { return false ; } $ thumber = new ThumbCreator ( $ url ) ; $ thumber -> resize ( 1200 , 1200 ) -> save ( [ 'format' => 'jpg' ] ) ; $ url = $ thumber -> getUrl ( ) ; } list ( $ width , $ height ) = $ this -> getPreviewSize ( $ url ) ; return new Entity ( compact ( 'url' , 'width' , 'height' ) ) ; } , $ this -> extractImages ( $ html ) ) ; return array_filter ( $ images ) ; }
Gets all the available images from an html string, including the previews
of Youtube videos, and returns an array of `Entity`
@param string $html Html string
@return array Array of entities. Each `Entity` has `url`, `width` and
`height` properties
@since 2.23.0
@uses extractImages()
@uses getPreviewSize()
Gets all the available images from an html string including the previews of Youtube videos and returns an array of Entity